View Full Version : Resolved count(*) problem
Hi all,
I've been grappling with this for a few days now:
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 '=1 AND `expires` >1293989873' at line 1
this is the full query:
SELECT count( * ) FROM `table` WHERE `show` =1 AND `expires` >1293989498
Odd thing is, this query works fine from phpMyAdmin, but fails from my script. Any ideas?
thanks!
jscheuer1
01-02-2011, 07:03 PM
I know next to nothing about this, but it strikes that may be a shortcut unavailable outside phpMyAdmin where presumably a context of some sort has already been established, see:
http://www.codingforums.com/showthread.php?p=440767#post440767
and the posts that immediately follow it for more of a hint at what I'm talking about. There, though it doesn't figure in the resolution of the original question, a context must be established.
The same is true of various debugging tools in javascript. What you may type there and the results you get vary from what can be done in actual script. The results can usually be obtained, but more code is often required.
Thanks, John,
Apologies, but this turned out to be a completely unrelated problem. Other components of the script were outputting a malformed "LIMIT" statement, which sometimes gave an empty result and sometimes gave a syntax error.
Thanks for your help anyway!
nextdownload
01-06-2011, 06:02 PM
try
SELECT count( * ) FROM `table` WHERE show=1 AND expires>1293989498
thanks, but I already solved this. It was a typo elsewhere in the query.
And, just to point out, using backticks around column names is good practice - and sometimes, quite worth your while. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.