Page 1 of 1

Syntax Error

Posted: Wed May 24, 2006 8:53 pm
by BigAbe

Code: Select all

$bb = "SELECT COUNT (*) AS count FROM ads WHERE (adActive = 1)";

$getcount2 = mysql_query($bb) or die(mysql_error());

while($row2 = @mysql_fetch_array($getcount))
	$total = $row2["count"];
Firefox tells me this :
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 '(*) AS ct FROM ads WHERE (adActive = 1)' at line 1
Any thoughts?

-- Abe --

Posted: Wed May 24, 2006 8:55 pm
by feyd
COUNT is a function, remove the space between it and the first paren.

Posted: Wed May 24, 2006 9:29 pm
by BigAbe
feyd wrote:COUNT is a function, remove the space between it and the first paren.
Thanks!