我有一个查询,它从db中检索多个行的两个列。我希望它在使用php的表中显示它,我猜我必须使用二维数组。请帮助我如何继续。
while($row=mysql_fetchrow_array($qry))
{
Please guide how to store the columns in the array[][]
}
[Please guide on how to display the result in the display page]
foreach( )
{
}
答案 0 :(得分:0)
// store the columns in the array[][]:
$res = array();
while($row=mysql_fetch_array($qry, MYSQL_NUM)) {
$res[] = $row;
}
// display the result in the display page
echo "<table>\n";
foreach($res as $row) {
echo "<tr>\n";
foreach ($row as $fld) {
echo "<td>$fld</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";