Support » Plugin: Meow Gallery (+ Gutenberg Gallery Block) » SQL Syntax Error

  • Resolved Blamedutchie

    (@blamedutchie)


    Hi,

    After the most recent update, db errors show up in debug when creating a new gallery. Also, after saving the draft, when I click on Edit Gallery, the dialogue shows the thumbnails of ALL image files. I tried the same in an existing gallery and then the dialogue shows the gallery thumbnails as expected.

    [23-Mar-2019 11:49:02 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 5 for query SELECT p.ID id, p.post_excerpt caption, m.meta_value meta
    			FROM wp_pqjj_posts p, wp_pqjj_postmeta m
    			WHERE m.meta_key = '_wp_attachment_metadata'
    			AND p.ID = m.post_id
    			AND p.ID IN (,) made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, Meow_Gallery_Run->preview, Meow_Gallery_Run->gallery, Meow_Tiles_Generator->build, Meow_Gallery_Generator->prepare_data
    [23-Mar-2019 11:49:02 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,)' at line 5 for query SELECT p.ID id, p.post_excerpt caption, m.meta_value meta
    			FROM wp_pqjj_posts p, wp_pqjj_postmeta m
    			WHERE m.meta_key = '_wp_attachment_metadata'
    			AND p.ID = m.post_id
    			AND p.ID IN (,,,) made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, Meow_Gallery_Run->preview, Meow_Gallery_Run->gallery, Meow_Tiles_Generator->build, Meow_Gallery_Generator->prepare_data

    AND p.ID IN (,,,) iterates and then further down the list it starts to show the actual p.ID:

    [23-Mar-2019 11:49:06 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,,,)' at line 5 for query SELECT p.ID id, p.post_excerpt caption, m.meta_value meta
    			FROM wp_pqjj_posts p, wp_pqjj_postmeta m
    			WHERE m.meta_key = '_wp_attachment_metadata'
    			AND p.ID = m.post_id
    			AND p.ID IN (,,,,,) made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, Meow_Gallery_Run->preview, Meow_Gallery_Run->gallery, Meow_Tiles_Generator->build, Meow_Gallery_Generator->prepare_data
    [23-Mar-2019 11:49:09 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,,,,,,,,,,)' at line 5 for query SELECT p.ID id, p.post_excerpt caption, m.meta_value meta
    			FROM wp_pqjj_posts p, wp_pqjj_postmeta m
    			WHERE m.meta_key = '_wp_attachment_metadata'
    			AND p.ID = m.post_id
    			AND p.ID IN (8393,,,,,,,,,,,,,) made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, Meow_Gallery_Run->preview, Meow_Gallery_Run->gallery, Meow_Tiles_Generator->build, Meow_Gallery_Generator->prepare_data
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @blamedutchie,

    That means that the attribute IDs in those galleries is full of empty values. I am not sure why, but the plugin doesn’t have this issue currently, and I didn’t get any other report.

    Do you still have the issues?
    Did you try to switch theme temporarily, to see if it’s caused by your theme?
    Are you using another gallery system at the same time?

    You can also try this: in the file mgl_run.php, after the comment “//DEBUG: Display $atts”, try to add this:

    $images = array_filter( $images, 'strlen' );

    Does it help?

    Hi Jordy,

    Thanks for your usual swiftness.

    Apart from the database errors, I see:

    [25-Mar-2019 12:15:40 UTC] PHP Warning:  Illegal string offset 'width' in /../plugins/meow-gallery/builders/tiles.php on line 57
    [25-Mar-2019 12:15:40 UTC] PHP Warning:  Illegal string offset 'height' in /../plugins/meow-gallery/builders/tiles.php on line 57
    [25-Mar-2019 12:15:40 UTC] PHP Warning:  Illegal string offset 'file' in /../plugins/meow-gallery/builders/builder.php on line 64

    I have not yet had the time to add your $images suggestion, but I’ve noticed that the database errors only show up when I use the Upload button provided inside the New Gallery Block. If I click Media Library and then use the Upload feature in the following screen, the errors don’t show up and the thumbnails when clicked on Edit Gallery are then shown without problem.

    We’ll keep in touch.

    • This reply was modified 10 months, 1 week ago by Blamedutchie.
    Plugin Author Jordy Meow

    (@tigroumeow)

    I think they are related. First I would like to make sure it doesn’t happen for you anymore with the changes I proposed. Otherwise, the next change might complicate things 🙂 This issue and the one before are totally related.

    Blamedutchie

    (@blamedutchie)

    I think so to, @tigroumeow . If not, there would be too much coincidence going on 😉

    I will test the change within the next 24 hours and let you know the results.

    Blamedutchie

    (@blamedutchie)

    Hi Jordy,

    Adding the line, gives the following warning:

    PHP Warning: array_filter() expects parameter 1 to be array, string given in /../../plugins/meow-gallery/mgl_run.php on line 80

    Galleries are longer being shown, neither on the front-end nor in the editor.

    About the _wp_attachment_metadata error: I know that could be a problem with an incorrectly serialized array that holds the image sizes, but I have not really an idea how to figure out could be wrong there, let alone how to fix it. In fact I have no idea whether it was a plug-in or the theme putting storing that data serialized. (also no idea why anyone would want to store attachment metadata serialized without plug-ins capable of changing parts of the resulting array)

    Oh well… step by step I’ll either fix it or wreck my site completely 😉

    Plugin Author Jordy Meow

    (@tigroumeow)

    Please contact me directly 🙂 That will be easier. Even if there is an issue to your install, I would prefer to handle it gracefully on the Meow Gallery side and display a helpful error message rather than just crashing.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘SQL Syntax Error’ is closed to new replies.