$sql = "select count(userId) from tblUser";
$result=mysql_query($sql,$link)or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_NUM);
echo $row[1];
print_r($row); is displaying no of records but whu echo is not working
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need
mysql_num_rowsThat’ll give you number of rows return from query.
If, however, you are using the
countkeyword in your query, you should modify your code like this:Update:
You can also count total users like this: