开发者

How to remove "warning:Cannot use a scalar value as an array"

开发者 https://www.devze.com 2023-03-17 12:27 出处:网络
here is my code: $i = 0; $list4 = array(); while($row_sent = $GLOBALS[\'db\']->sql_fetchrow($res_sent))

here is my code:

$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++;
}


try this.

declare $list4 as an array before your loop start.

$list4[] = array();

this may be useful.

Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号