Lots of questions regarding this sort of error. First its a warning not an error so your code will continue to work just fine. You can suppress by using error_reporting(E_ERROR)
which will only show errors that are fatal. Otherwise in your code if you dont want to see this error you need to do something like..
//only try loop if there is an array
if(is_array($_SESSION["qty"])){
foreach ($_SESSION["qty"] as $each_item) {
$item_id = $each_item['qty'];
$update_qty = mysqli_query("update cart set qty='$qty' LIMIT 1");
//change to mysqli_fetch_array!!
while ($row = mysqli_fetch_array($update_qty)) {
//you will only get one row in here like this
$_SESSION['qty']=$qty; //maybe do $_SESSION['qty'][]=$qty;
}
$total = $total * $each_item['qty'];
}
}else{
echo 'No array to be found here';
}
1
solved Invalid argument supplied for foreach with code