Jump to content

[SOLVED] Help with an array.


Vitalka

Recommended Posts

Hello.

I get following weird array values related error messages:

 

Notice: Undefined index: 5 in /.automount/server3/export/home/php701_081a04/public_html/store/check_out.php on line 296

 

Notice: Undefined index: 36 in /.automount/server3/export/home/php701_081a04/public_html/store/check_out.php on line 296

 

Notice: Undefined index: 6 in /.automount/server3/export/home/php701_081a04/public_html/store/check_out.php on line 296

 

 $value = 0;
    293         $new_stock = 0;
    294         $stock_prod = 0;
    295         foreach ($item_id as $key => $value){
    296                 $id_item = $item_id[$value];
    297                 $result = mysql_query("SELECT prod_stock FROM products_t WHERE prod_id='$id_item'") or die(mysql_error());
    298                 while ($row = mysql_fetch_array($result)){
    299                         $stock_prod = $row['prod_stock'];
    300                 //      $new_stock = $stock_prod - 1;
    301                 }
    302                 $new_stock = $stock_prod - 1; 
    303                 $result = mysql_query("UPDATE products_t SET prod_stock='$new_stock' WHERE prod_id='$id_item'") or die(mysql_error());
    304          
    305         }

 

Those index values are are stored in an array, and when I pull them it gives these error messages.

 

Any one know what's up with that?

 

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/101637-solved-help-with-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.