$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