Viktor Hesselbom
« Go back homeMySQL FUNCTION DB.count does not exist
I recently wanted to count the number of rows returned from a SQL query to a MySQL database. I first tried it in phpMyAdmin with a query something like this:
select count (id) from DBThis worked fine in phpMyAdmin but the "interesting" (annoying) thing is that in my live PHP code I got the error MySQL FUNCTION DB.count does not exist.
Turns out the MySQL does not like the whitespace after the function name, before the parameters. In phpMyAdmin they automatically fix this for you in your query but in your PHP code it obviously doesn't.
So that query should look like this:
select count(id) from DBHope this helped someone!