PHP Notice: Query failed

Discussion in 'Technical Support' started by freeze2, Apr 10, 2012.

  1. freeze2 Customer

    I've noticed on one of my 4.2.4 installs that the following is showing up in my server error log from time to time:

    Code:
    PHP Notice:  Query failed: 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 '-10, 10' at line 1 SQL:  SELECT p.id, p.owner, p.title, p.featured, p.section, p.shortDescription, p.description, p.price, p.dateadded, p.expiration, p.display, p.pHighlighted, p.pBold, p.hitcount, p.url, u.username, u.state, u.city, u.country, u.extra, u.extra2, u.extra3  FROM class_listings AS p LEFT JOIN class_users AS u ON p.owner = u.id  WHERE 1=1 AND p.price BETWEEN '0' AND '99999999999' AND p.expiration > NOW() AND p.display = "Y" GROUP BY p.id, p.owner, p.title, p.featured, p.section, p.description, p.dateadded, p.expiration, u.state, u.city, u.country ORDER BY dateadded desc, dateadded DESC LIMIT -10, 10 in /path-to-script/includes/classes/database/mysql.php on line 251
    Which file would I look to see where this error is being generated from? I have no idea what has triggered it, as it seems to be random.

    Any help would be great...thanks!
  2. Blair Administrator

    Very likely the includes/classes/kernel/Listings.php file.
  3. freeze2 Customer

    Thanks Blair...I will have a closer look at that file and see what I can find.
  4. Blair Administrator

    The last few times I've come across that error, it was a result of using reserved words in MySQL. You may want to take just a couple minutes and cross reference the words in the SQL statement throwing the error and MySQL's list of reserved words: http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html .... Make sure you're looking at the list that corresponds to your version of MySQL.

    Honestly, I don't think that's the problem but it couldn't hurt taking a couple minutes to check the list.
  5. freeze2 Customer

    Just an update on this...I have checked all files and everything seems to be normal. The last time the error occurred was over a month ago...so I can't really say what happened to cause them...but all seems to be fine now

Share This Page