phpstuff Posted December 31, 2013 Share Posted December 31, 2013 Hi, The queries on the 2 pages aren't the same - the query on pg 541 is shown in example B and has run succesfully in the screen shot. The query on the top of the previous page (540, #3) is different - I typed that into the terminal and ran it and received an error: SELECT t.thread_id, t.subject, username, COUNT(post_id) - 1 AS responses, MAX(DATE_FORMAT($last, '%e-%b-%y %1:$i %p')) AS last, MIN(DATE_FORMAT($first, '%e-%b-%y %1:%i %p')) AS first FROM threads AS t INNER JOIN posts AS p USING (thread_id) INNER JOIN users AS u ON t.user_id = u.user_id WHERE t.lang_id = {$_SESSION['lid']} GROUP BY (p.thread_id) ORDER BY last DESC; ERROR 1064 (42000): 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 '['lid']} GROUP BY (p.thread_id) ORDER BY last DESC' at line 5 I noticed in the example B on page 541 there are many differences such as having CONVERT_TZ and setting t.lang_id = 4. Is this conflicting/wrong, or just a different example? Why does the query I entered above have this error? Link to comment Share on other sites More sharing options...
phpstuff Posted December 31, 2013 Author Share Posted December 31, 2013 I figured out an issue with the above... This code: (DATE_FORMAT($last, '%e-%b-%y %1:$i %p') I have a "$" where it should be a "%" - so in the browser it was saying call to undefined variable i - which helped track down the issue quickly. Link to comment Share on other sites More sharing options...
Larry Posted January 1, 2014 Share Posted January 1, 2014 Ah...that would do it! Kudos for figuring it out and thanks for letting us know. Link to comment Share on other sites More sharing options...
Recommended Posts