我想使用数字获取列的值是否可以在 php 中通过列号获取 $row 值
我想为列运行 foeach 循环并按列号获取值
try {
$database = new DB();
$db = $database->Connect();
foreach ($db->query($sql) as $row) {
$data .='<tr>';
$columnNumber = 0;
foreach ($db->query($sql) as $column)
{
$data .= "<td>";
$data .= $row[$columnNumber];
$data .= "</td>";
}
$data .='</tr>';
}
$database->Close();
}
catch (PDOException $e)
{
$data .= "There is some problem in connection: " . $e->getMessage();
}
BIG阳