Title: SQL Syntax Error
Last modified: March 23, 2019

---

# SQL Syntax Error

 *  Resolved [Blamedutchie](https://wordpress.org/support/users/blamedutchie/)
 * (@blamedutchie)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/)
 * 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](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11352697)
 * Hi [@blamedutchie](https://wordpress.org/support/users/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?
 *  Thread Starter [Blamedutchie](https://wordpress.org/support/users/blamedutchie/)
 * (@blamedutchie)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11358542)
 * 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 7 years, 1 month ago by [Blamedutchie](https://wordpress.org/support/users/blamedutchie/).
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11369573)
 * 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.
 *  Thread Starter [Blamedutchie](https://wordpress.org/support/users/blamedutchie/)
 * (@blamedutchie)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11372605)
 * I think so to, [@tigroumeow](https://wordpress.org/support/users/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.
 *  Thread Starter [Blamedutchie](https://wordpress.org/support/users/blamedutchie/)
 * (@blamedutchie)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11373032)
 * 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](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11373396)
 * 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.

 * ![](https://ps.w.org/meow-gallery/assets/icon-256x256.png?rev=2791571)
 * [Meow Gallery](https://wordpress.org/plugins/meow-gallery/)
 * [Support Threads](https://wordpress.org/support/plugin/meow-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/meow-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meow-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meow-gallery/reviews/)

## Tags

 * [illegal string offset](https://wordpress.org/support/topic-tag/illegal-string-offset/)

 * 6 replies
 * 2 participants
 * Last reply from: [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/sql-syntax-error-17/#post-11373396)
 * Status: resolved