Title: SQL ERROR
Last modified: August 30, 2016

---

# SQL ERROR

 *  [nvg](https://wordpress.org/support/users/nvg/)
 * (@nvg)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/)
 * Getting an SQL error in the server log:
    [03-Nov-2015 18:54:54 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 ‘LIMIT 50’ at line
   1 for query SELECT DISTINCT wp_ngg_pictures.* , GROUP_CONCAT(CONCAT_WS(‘@@’, 
   meta_key, meta_value)) AS ‘extras’ FROM `wp_ngg_pictures` LEFT OUTER JOIN `wp_postmeta`
   ON `wp_postmeta`.`post_id` = `extras_post_id` WHERE (`galleryid` = 1) GROUP BY
   wp_ngg_pictures.pid ORDER BY LIMIT 50 made by do_action(‘gallery_page_nggallery-
   manage-gallery’), call_user_func_array, nggAdminPanel->show_menu, nggManageGallery-
   >controller, nggallery_picturelist, C_Image_Mapper->run_query, ExtensibleObject-
   >__call, ExtensibleObject->_exec_cached_method, ReflectionMethod->invokeArgs,
   C_CustomTable_DataMapper_Driver_Mixin->run_query
 * Here’s the stats:
 *     ```
       WordPress: 4.3.1
         NextGEN: 2.1.15 (was kept up to date with each previous version )
           MySQL: 5.5.46-cll
             PHP: 5.4.35 with Safe Mode OFF
          Apache: 2.2.29 with mod_rewrite
         Hosting: WiredTree dedicated server
           Theme: Avada 2.1.0  (Error still occurs with WordPressTwenty Fifteen theme activated)
         Plugins: Error occurs even with all other plugins deactivated
       ```
   
 * Thanks for your help
 * [https://wordpress.org/plugins/nextgen-gallery/](https://wordpress.org/plugins/nextgen-gallery/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713458)
 * [@nvg](https://wordpress.org/support/users/nvg/) – How many images do you have
   in your gallery ID 1?
 * Thanks!
 * – Cais.
 *  Thread Starter [nvg](https://wordpress.org/support/users/nvg/)
 * (@nvg)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713466)
 * 13 images
 * All the rest are about the same, no big quantities.
 * Thanks….
 *  Thread Starter [nvg](https://wordpress.org/support/users/nvg/)
 * (@nvg)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713468)
 * Also just when I was in there noticing that no images are actually showing up
   on the admin, just the front end. Not just talking about the thumbnails but the
   entire rows are missing. It shows how many is all in the admin. No errors on 
   the front end…
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713513)
 * [@nvg](https://wordpress.org/support/users/nvg/) – Where are you attaching to
   this action hook: `do_action('gallery_page_nggallery-manage-gallery')` as we 
   do not actually have a hook with that specific handle.
 * Thanks!
 * – Cais.
 *  Thread Starter [nvg](https://wordpress.org/support/users/nvg/)
 * (@nvg)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713519)
 * Hmmm… interesting. Well we’re not doing anything with it ourselves – no custom
   hooks or anything – in fact on this site there’s no functions.php file in the
   child theme so it’s basically just the Avada theme files.
 * I did a couple full text searches from within the web root dir:
 *     ```
       /home/allfuel/www]# grep -R 'gallery_page_nggallery-manage-gallery' .
       ```
   
 * => only turns up the results in the wp-admin error_log file
 *     ```
       /home/allfuel/www]# grep -R 'gallery_page_nggallery' .
       ```
   
 * => only turns up the results in the wp-admin error_log file as well
    and:
 *     ```
       /home/allfuel/www]# grep -R 'manage-gallery' .
       ```
   
 * => brings back only results from the error_log plus files from the plugin dirs:
 *     ```
       ./wp-content/plugins/nextgen-gallery/
       ./wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/
       ./wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_addgallery_page/
       ./wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post
       ./wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/
       ```
   
 * ?
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713546)
 * [@nvg](https://wordpress.org/support/users/nvg/) – Do you see the same issues
   if you temporarily switch to a default WordPress Twenty series theme? Unfortunately
   the Avada theme has caused problems in the past for NextGEN Gallery and may be
   doing so again …
 * – Cais.
 *  Thread Starter [nvg](https://wordpress.org/support/users/nvg/)
 * (@nvg)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713549)
 * Hi – yes it does (see my original post above). But it is an older version of 
   Avada. I’m paranoid to upgrade that theme because even with a child theme Avada
   tends to go senile when it gets upgraded. But I may have to resort to that. I
   just figured since I didn’t see that hook anywhere in any of the Avada files 
   that it was the plugin itself – but I may have to back it all up and try upgrading
   Avada to get this resolved it looks like.
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713562)
 * [@nvg](https://wordpress.org/support/users/nvg/) – We strongly recommend always
   staying up-to-date with all of your active plugins, your current theme (and as
   needed its parent) as well as WordPress core itself. We look to the site being
   current before we can really offer any assistance in most cases as well.
 * Thanks!
 * – Cais.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘SQL ERROR’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

 * [sql-error](https://wordpress.org/support/topic-tag/sql-error/)

 * 8 replies
 * 2 participants
 * Last reply from: [photocrati](https://wordpress.org/support/users/photocrati/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/sql-error-31/#post-6713562)
 * Status: not a support question