$i = 0;
while ($row = mysql_fetch_array($result))
{
$resultset[] = $row;
$columns[] = mysql_fetch_field($result, $i);
}
然后尝试打印
<tr><th><?php echo $columns[0] ?></th><th><?php echo $columns[1] ?></th></tr>
我得到一个错误
Catchable fatal error: Object of class stdClass could not be converted to string
我注意到,$我不递增,总是有值0。此外,'$ row'和'$ resultset'在这个例子中未使用,并且'$ result'没有在示例范围内定义。 – 2009-12-05 19:10:15
你是对的忘了增加$我:) – programmernovice 2009-12-05 19:24:51