I am trying to show on my page the total Registered Users. I am using this:
<?php
//connect to db
require_once('connect.php');
$usrcnt = mysql_query("SELECT COUNT(DISTINCT ID) FROM members");
$res = mysql_num_rows($usrcnt);
$cnt_mbrs = mysql_fetch_array($res);
?>
And then I call $cnt_mbrs in my page but I get errors like:
mysql_num_rows(): supplied argument is not a valid MySQL result resource...
Is it correct what I am doing?