<分区>
Possible Duplicate:
PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given
我正在尝试在查询后从 mysql 对象构建一个数组。
查询中返回的数字或行是 68,这就是为什么我认为 forloop 会很好。但是 php 不喜欢我在 forloop 中的代码。
代码如下:
$result = $db->query("SELECT * FROM `networktariff`");
$rows = mysql_num_rows($result);
for ($i= 0; $i<$rows; $i++)
{
$tariffs[$i] = mysql_fetch_assoc($result[$i]);
}
我收到一条错误消息:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in /usr/local/www/apache22/data/quote/index.php on line 58