我有这行代码:
$row = mysqli_fetch_row($result);
print_r($row);
结果是:
Array ( [0] => 1 [1] => [2] => 2014-02-21 [3] => 13:07:00 [4] => Toronto [5] => New York [6] => 2014-02-25 15:19:41 [7] => [8] => 2014-02-20 [9] => Toronto [10] => 2 [11] => New York [12] => 3 )
我的问题是,如何让它显示字段名称,如下所示:
[id] => 1 ['isOpen'] => ['date'] => 2014-02-21
答案 0 :(得分:6)
您需要使用mysqli_fetch_assoc()
代替mysqli_fetch_row()
使用此
$row = mysqli_fetch_assoc($result);
print_r($row);