我在mysql中有这个表,表“distance”:
id | distance | 1 | 8 | 2 | 5 | 3 | 7 |
我想输出如下:
8 5 7 8 5 7 8 5 7
我如何在PHP中编码?谢谢,我是PHP的新手。
答案 0 :(得分:0)
试试这个
$tableRows[0]=array("id"=>1,"distance"=>8);
$tableRows[1]=array("id"=>2,"distance"=>5);
$tableRows[2]=array("id"=>3,"distance"=>7);
$counter=0;
foreach($tableRows as $tableRow)
{
foreach($tableRows as $tableRow)
{
echo $tableRow["distance"]."\t";
}
echo "\n";
}