I have the following MySQL query which works fine in PHPMyAdmin:
[CODE]Select COUNT(*) from todo_todolist where compl = 0
The output looks like
[QUOTE]
COUNT(*)
3
Now I want to show the count number in PHP but it doesn’t work:
[code=php]$dbuser=”user”;
$dbpass=”pass”;
$dbname=”dbname”; //the name of the database
$chandle=mysql_connect(“localhost”, $dbuser, $dbpass) or die(“Connection Failure to Database”);
mysql_select_db($dbname, $chandle) or die ($dbname . ” Database not found. ” . $dbuser);
$query1=”Select COUNT(*) from todo_todolist where compl = 0″;
$result=mysql_query($query1) or die(“Failed Query of ” . $query1);
$thisrow=mysql_result($result);
When I add
[code=php]echo $result . $thisrow[0];
it shows me “Resource id #29 ” so echo $result gives me ths resource id #29 error and echo $thisrow is empty.
How can I display the count number from the SQL query in PHP?
Thanks in advance.