Take the 2-minute tour ×  hello I'm on the finishline of writing
a chat script. The only thing left is to compare how many
messeges had the user seen with the total number in the
database. Now the following line doesn't seem to work and I've
been staring at it for an hour and can't find the cause.  $count
= mysql_query('SELECT COUNT(id) as total FROM konsultaciq WHERE
cat = "'.$_SESSION['key'].'" '); echo count(total);  The echo
gives me a value of "1", when there are 8 entries in the
database under that "cat"  share|improve this question Have you
fetched the result? –  Yogesh Suthar Jul 29 '13 at 4:18 First,
total should either be defined as a constant or it should be
$total. In either case, you aren't assigning a value to it.
Secondly, the MySQL extension is deprecated. Stop using it right
now and use PDO or MySQLi instead –  Phil Jul 29 '13 at 4:18
Shouldn't that be echo $count(total); or echo $total;, or echo
$count;? Try one of those. You have $count as your variable but
not echoing it correctly. –  Fred