multiple foreach

From: Date: Fri, 21 Mar 2003 01:59:58 +0000
Subject: multiple foreach
Groups: php.general 
Request: Send a blank email to php-general+get-140524@lists.php.net to get a copy of this message
Maybe someone can see what I'm trying to do with this: foreach($charge as $c){ foreach($size_id as $s){$sql = "UPDATE products_to_sizes SET surcharge = '$c' WHERE product_id = '$products_id' AND size_id = '$s'"; mysql_query($sql) or die ("Couldn't update rows".MYSQL_ERROR()); print $sql.'<br>';} } I get this: UPDATE products_to_sizes SET surcharge = '1.50' WHERE product_id = '28' AND size_id = '6' UPDATE products_to_sizes SET surcharge = '1.50' WHERE product_id = '28' AND size_id = '7' UPDATE products_to_sizes SET surcharge = '3.00' WHERE product_id = '28' AND size_id = '6' UPDATE products_to_sizes SET surcharge = '3.00' WHERE product_id = '28' AND size_id = '7' I need to get rid of the two middle statements Help!! :-) -- Richard Whitney * Transcend Development Producing the next phase of your internet presence. rw@xend.net * http://xend.net * 602-971-2791 * * * * * *__ * * _/ \___ * * / * \* * */ * * \ * */\_ |\ / \_ / \ / \____/ \ / \ / \ / \

« previous php.general (#140524) next »