如何将表字段(列)名称存储到一个数组中?

时间:2015-07-15 11:55:32

标签: php mysql mysqli

这是我的代码,我正在尝试将值存储到Array中。

$result = $cid->query("SHOW COLUMNS FROM commissions");
echo $count = $result->num_rows;
while ($row = $result->fetch_assoc()) {

    echo $row['Field'];
    echo "<br/>";
}

我正在尝试这样做$ar[]=$row;,但没有任何显示!!

$result = $cid->query("SHOW COLUMNS FROM commissions");
echo $count = $result->num_rows;
while ($row = $result->fetch_assoc()) {

    ar[] = $row;
    echo "<br/>";
}
for($i = 0, $i<12, $i++) {
    echo ar['field'][0];
}

输出中没有显示

0 个答案:

没有答案