You have an error in your SQL syntax

Firetrak

Member
Oct 24, 2014
131
0
76
i'm trying to fix a slow down on my wordpress website and i'm getting this error, but i really dont know what it means, there is no "if" statement in line one, hopefully someone might have an idea to help me.

MysqlError: 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 'IF' at line 1

Sample stack trace
in mysql_query called at /home/nailedmagazine/public_html/wp-includes/wp-db.php (1663)
…db::_do_query called at /home/nailedmagazine/public_html/wp-includes/
wp-db.php (1567)
in wpdb::query called at /home/nailedmagazine/public_html/wp-includes/wp-db.php (1953)
…sults called at /home/nailedmagazine/public_html/wp-admin/includes/
upgrade.php (1694)
…led at /home/nailedmagazine/public_html/wp-content/themes/nailed/
functions.php (127)
in na_create_posts_views_table called at ? (?)
…r_func_array called at /home/nailedmagazine/public_html/wp-includes/
plugin.php (496)
in do_action called at /home/nailedmagazine/public_html/wp-settings.php (374)
in require_once called at /home/nailedmagazine/public_html/wp-config.php (103)
in require_once called at /home/nailedmagazine/public_html/wp-load.php (29)
in require_once called at /home/nailedmagazine/public_html/wp-blog-header.php (12)
in require called at /home/nailedmagazine/public_html/index.php (17)
 

purbeast0

No Lifer
Sep 13, 2001
52,939
5,814
126
we won't really be able to tell you what the error is if you don't tell us what the sql syntax of the query is.

or at least copy/paste the code included in line 1663 of wp-db.php
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
13
81
www.markbetz.net
Just googling around I see incidences of similar errors going back over nine years. Appears to usually be related to a specific version of a component. Are all your plugins updated?
 

Firetrak

Member
Oct 24, 2014
131
0
76
i think it might have something to do with a plugin called WP-PostViews that was no longer installed, i see a table in myphpadmin called wp_post_views that i think was left behind, this table is 36mb in size, all other tables are maybe 200kb in size.

If i empty this table do you think it might help?
 

Firetrak

Member
Oct 24, 2014
131
0
76
Also this query

$this->query( $query );

Seems to be the main one causing issues, but I dont really know what it means, its on 3 lines in the .php file and its the one causing the issues.
 

uclabachelor

Senior member
Nov 9, 2009
448
0
71
i'm trying to fix a slow down on my wordpress website and i'm getting this error, but i really dont know what it means, there is no "if" statement in line one, hopefully someone might have an idea to help me.

MysqlError: 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 'IF' at line 1

Sample stack trace
in mysql_query called at /home/nailedmagazine/public_html/wp-includes/wp-db.php (1663)
…db::_do_query called at /home/nailedmagazine/public_html/wp-includes/
wp-db.php (1567)
in wpdb::query called at /home/nailedmagazine/public_html/wp-includes/wp-db.php (1953)
…sults called at /home/nailedmagazine/public_html/wp-admin/includes/
upgrade.php (1694)
…led at /home/nailedmagazine/public_html/wp-content/themes/nailed/
functions.php (127)
in na_create_posts_views_table called at ? (?)
…r_func_array called at /home/nailedmagazine/public_html/wp-includes/
plugin.php (496)
in do_action called at /home/nailedmagazine/public_html/wp-settings.php (374)
in require_once called at /home/nailedmagazine/public_html/wp-config.php (103)
in require_once called at /home/nailedmagazine/public_html/wp-load.php (29)
in require_once called at /home/nailedmagazine/public_html/wp-blog-header.php (12)
in require called at /home/nailedmagazine/public_html/index.php (17)

You have the stack trace so open up /home/nailedmagazine/public_html/wp-includes/wp-db.php, go to line 1663, and echo out the actual query to see what's going on... after determining what the syntax error is, you have to back track from the stack trace and look at source code to see which file is building the query incorrectly.
 

Firetrak

Member
Oct 24, 2014
131
0
76
hi uclabachelor could you elaborate i'm not sql proficient at all.

this is the actual query: $this->query( $query );
 

uclabachelor

Senior member
Nov 9, 2009
448
0
71
hi uclabachelor could you elaborate i'm not sql proficient at all.

this is the actual query: $this->query( $query );

Right before that line, add:

Code:
echo $query;
die();

and post the contents of the output on the web page on here... don't forget to undo your changes to that file when you're done with it.
 

purbeast0

No Lifer
Sep 13, 2001
52,939
5,814
126
Also this query

$this->query( $query );

Seems to be the main one causing issues, but I dont really know what it means, its on 3 lines in the .php file and its the one causing the issues.

that is not the actual query, that is the php code. you have to tell use what the value of $query is.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |