我有这个PHP代码:
$tunnid = array();
while ($row = mysql_fetch_assoc($result)) {
$tunnid[] = $row['total'];
}
$this->set('tunnid', $tunnid);
mysql_free_result($result);
要显示它,我有这个:
<?php
if(!empty($tunnid)) {
foreach($tunnid as $tund) {
echo "$tunnid";
}
}
由于某种原因,这会返回ArrayArrayArrayArray
我在这里做错了什么?感谢
答案 0 :(得分:4)
你有一点错字
<?php
if(!empty($tunnid)) {
foreach($tunnid as $tund) {
echo "$tund"; //not tunnid
}
}