If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Error from error_log

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-20-09, 09:35
levani levani is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
Error from error_log

Hi

Yesterday I saw my error_log and was very astonished. There were more than 10000 errors, and only this:

Quote:
[18-Mar-2009 02:03:55] 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 'AND taxonomy = 'category'' at line 1 for query SELECT * FROM wp_term_taxonomy WHERE term_taxonomy_id = AND taxonomy = 'category' made by require, require_once, include, include
Does anyone know what it means? It's a wordpress database.

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-20-09, 10:08
buckeye234 buckeye234 is offline
Registered User
 
Join Date: Sep 2002
Location: Ohio
Posts: 204
I know nothing of Wordpress, but look at the following SQL statement from your error log and tell me what is wrong with it:

Code:
SELECT * 
FROM wp_term_taxonomy 
WHERE term_taxonomy_id = 
AND taxonomy = 'category'
Reply With Quote
  #3 (permalink)  
Old 03-20-09, 10:10
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
yes, it means there's a syntax error in your query

let me revise your query slightly to be more readable...
Code:
SELECT * 
  FROM wp_term_taxonomy 
 WHERE term_taxonomy_id = 
   AND taxonomy = 'category'
can you spot the error now?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 03-20-09, 10:12
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
argghh, sniped again!!! by a full two minutes!!

nice one, buckeye

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 03-20-09, 14:26
levani levani is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
As I guess you're about the empty value after term_taxonomy_id, is that right?
Reply With Quote
  #6 (permalink)  
Old 03-20-09, 15:36
buckeye234 buckeye234 is offline
Registered User
 
Join Date: Sep 2002
Location: Ohio
Posts: 204
Quote:
Originally Posted by levani
As I guess you're about the empty value after term_taxonomy_id, is that right?
Correct! Someone, or something, must be repeatedly submmitting this improper query. Your job, should you decide to accept it, is to find the cause of this massively annoying error message and stamp it out.

This post will self destruct in 30 seconds.
Reply With Quote
  #7 (permalink)  
Old 03-22-09, 05:20
levani levani is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
This is the code which gets data from database:

Quote:
$mtladmtavari = $wpdb->get_row("SELECT * FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = $araperi AND taxonomy = 'category' ");
As you see there is $araperi variable after term_taxonomy_id and it seems this variable doesn't always have any value.

Will this code prevent database query if the $araperi variable is empty?

Quote:
<?php
if ( $araperi != NULL ) {
$mtladmtavari = $wpdb->get_row("SELECT * FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = $araperi AND taxonomy = 'category' ");
} ?>
Have you got any better ideas?

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On