我正试图在我的网页上展示注册用户总数。 我正在利用这一点:
<?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);
?>
我在我的网页上打上$cnt_mbrs
,但我有以下错误:
mysql_num_rows(): supplied argument is not a valid MySQL result resource...
Is it correct what I am doing?