I'm a beginner PHP programmer, so sorry if I'm asking some silly question. I've set up a MySQL database with a table carrying a list of boolean values. I want the PHP page count the number of 'true' on a column (from the table) and display it as a single number. Eg, if there is 4 'true's on the column, it display '4'. How do I do it?
I've tried to start it off, but it's displaying something wired - 'Resource id #4', which I have no idea what it is. Here is my code -
<?php
include("conmysql.php");
$selectdb = @mysql_select_db("vote");
if (!$selectdb) die("Connect database fail!");
//find number of people supporting
$sql = 'SELECT COUNT(support) FROM address WHERE support=1';
$result = mysql_query($sql);
if (!result) {
die('Invalid query: ' . mysql_error());
}
echo "$result";
?>
CAN SOMEONE HELP!!
If you want to look at my real example, here is the page on my server - http://vernmedia.dyndns.org/.
Thanks