Support » Fixing WordPress » Database error in SQL syntax

  • Hello, I have an error in my WP database and I have no idea what this means – or how to repair it. Just hoping someone is able to please help, in language that I can understand 🙂
    This was happening on WP 8.3 – I have upgraded to 3.9.1 and still the same.
    Here is the error message – the error file is massive:

    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 9 for query SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type,comment_author_url,
    
    				SUBSTRING(comment_content,1,45) AS com_excerpt
    
    				FROM Nomd45_comments
    
    				LEFT OUTER JOIN Nomd45_posts ON (Nomd45_comments.comment_post_ID =
    
    				Nomd45_posts.ID)
    
    				WHERE comment_approved = '1' AND comment_type = '' AND
    
    				post_password = ''
    
    				ORDER BY comment_date_gmt DESC
    
    				LIMIT  made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/maxmag/single.php'), get_sidebar, locate_template, load_template, require_once('/themes/maxmag/sidebar.php'), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, maxmag_tabs_widget->widget
Viewing 6 replies - 1 through 6 (of 6 total)
  • That’s an issue with your maxmag theme. You need to check with those developers to see if there is a fix or an update for WP 3.9.

    Thread Starter karmamack

    (@karmamack)

    Gee, that was fast thank you! I will check with the theme people now. Although I have 2 sites using that theme and the other one is fine. All the same plugins, too.

    Thread Starter karmamack

    (@karmamack)

    Me again, Theme Forest (max-mag) told me to <<<remove your installation of WordPress, re-install the latest version of WordPress and then install the latest version of the theme without installing any other plugins or making any changes>>>

    But, how do I remove the WordPress installation without losing all the posts etc? There are over 200 …

    The post content is not in the WordPress files, its in your MySql database. So you can replace the files but not the database.

    Delete then replace your copies of all files except the wp-config.php file and the /wp-content/ directory with copies from a fresh WordPress download. This will effectively replace all of your core files without damaging your content and settings. Some uploaders tend to be unreliable when overwriting files, so delete the original files before replacing them.

    Keep wp-config.php because the settings in here link your new WordPress files your old database.

    Keep the /wp-content/ directory because it contains your uploads.

    Nevertheless, take a good backup before starting.

    Thread Starter karmamack

    (@karmamack)

    OK, thank you for replying. But I am not understanding why to replace the WordPress files when it is the database that has the error.
    I think I need to find some help, this is way over my head.

    Its easy to make it worse if you are not confident. You can post a WordPress job here.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Database error in SQL syntax’ is closed to new replies.