I am trying to count the total number of the line in database(MySQL)by this code;
Code: Select all
$tel_num = mysql_query("e;SELECT COUNT(*) FROM tel_detail"e;, $db);How I can solve this problem?
Moderator: General Moderators
Code: Select all
$tel_num = mysql_query("e;SELECT COUNT(*) FROM tel_detail"e;, $db);Code: Select all
$result = mysql_query("SELECT COUNT(*) AS tot_rows FROM tel_detail", $db);
echo mysql_result($result, 0, 'tot_rows');it gives 4 because that is the mysql result resource ID integer from mysql operation.mustafamisir wrote:Hi all,
I am trying to count the total number of the line in database(MySQL)by this code;The value of $tel_num must be 85, but it gives only 4.Code: Select all
$tel_num = mysql_query("e;SELECT COUNT(*) FROM tel_detail"e;, $db);
How I can solve this problem?
Code: Select all
$tel_num = mysql_fetch_array(mysql_query("select count(*) as count from tel_detail",$db));
echo $tel_num['count'];