We are getting the following message when we try to run this loop: Warning: Invalid argument supplied for foreach() in /var/www/products/product_admin/item_setup_processor.php on line 167
We just moved the page from yahoos webhosting running php4 to an inhouse server running php5. I tried running a count on the array and it says there is one element in there, which would be correct. So, I'm at a loss for ideas. It was working just fine on yahoos servers.
Any ideas?
$options4 = array($category_ex); echo count($options4); //results in 1 meaning the array isn't empty foreach( $category_ex as $key => $value){ //posts id of existing categories selected mysql_select_db("coas50", $con); $cat_query="SELECT Cat_ID FROM coas50.pro_sub_categories WHERE Sub_ID='$value'"; $result=mysql_query($cat_query) or die(mysql_error()); while ($row=mysql_fetch_array($result)) {
$cat_id=$row["Cat_ID"]; } $sql="INSERT INTO coas50.pro_categories_look_up SET Item_ID='$user_id', Cat_ID='$cat_id', Sub_Cat_ID='$value'";