I want to fetch some data from my database which something weird came out.

<?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";
?>

the 'support' variable is set to boolean, where I want to get all the number of 1s.

and the result came out to be 'Resource id #4'. Can someone help!

The thing is, rather than fetching the whole row of result or even the whole table, I want do do a counter which can add up how many '1' in my table. Is there a way to solve it?
Thanks for the previous reply btw.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.