PHP and MySQL: Number of rows returned

梦想与她 提交于 2019-12-01 11:29:11

Like Michiel said, mysql_num_rows() do the job. But if you want to work with more than one rows using an array, you can use count() too.

$data = array();
while($row = mysql_fetch_array($maxa, MYSQL_ASSOC)) {
  $data[] = $row;
}
$count1 = mysql_num_rows($maxa);
$count2 = count($data);

Use the function mysql_num_rows()

Have a look at: http://nl3.php.net/manual/en/function.mysql-num-rows.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!