這裏是我的代碼:如何刪除「警告:無法使用標量值作爲數組」
$i = 0;
$list4 = array();
while($row_sent = $GLOBALS['db']->sql_fetchrow($res_sent))
{
$sql_sent2 = "SELECT * FROM ".$GLOBALS['table']['sent']." WHERE `sent_id` ='".$row_sent['sent_id']."'";
//echo $sql_size2; exit;
$res_sent2 = $GLOBALS['db']->sql_query($sql_sent2);
$num = $GLOBALS['db']->sql_numrows($res_sent2);
if($num > 0)
{
while($row_sent2 = $GLOBALS['db']->sql_fetchrow($res_sent2))
{
$list4[$i]['sent_id'] = $row_sent2['sent_id']; //this line shows error
$list4[$i]['sent_name'] = $row_sent2['sent_name'];//this line shows error
$list4[$i]['sent_qty'] = $row_sent['sent_qty'];//this line shows error
}
}
else
{
$list4=0;
}
$i++;
}
哪一行發生錯誤? –
add'$ list4 [$ i] = array()'; – thetaiko
我評論說,從我得到這個警告的三條線 – Moumita