我有这样的表例如检索许多行的PHP MySQL的
+------+---------+------+
| id | item_id | type |
+------+---------+------+
| 1 | 2 | book |
| 1 | 1 | pen |
+------+---------+------+
我想要检索的所有数据,其中ID = 1 PHP脚本,这里是我用
<?php
$stat="select item_id, type from tb where id=1";
$query = mysqli_query($con, $stat);
$result = mysqli_fetch_array($query,MYSQLI_ASSOC);
print_r($result);
?>
代码结果是:Array ([item_id] => 2 [type] => book)
那只是第一行,如何检索php代码中的所有行?
查看答案[这个问题](http://stackoverflow.com/questions/4643340/mysql-fetch-array-add-all-rows) – 2011-04-15 07:41:56