Thank you, Martin - you're a certifiable genius!
It's just that $size needed to be $size_id - I fixed that, though.

Thanks!

Richard

Quoting Martin Towell <[EMAIL PROTECTED]>:

### try this...
### 
### for ($i = 0; $i < count($charge); $i++)
### {
###   $c = $charge[$i];
###   $s = $size[$i];
###   $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>';
### }
### 
### -----Original Message-----
### From: Richard Whitney [mailto:[EMAIL PROTECTED]
### Sent: Friday, March 21, 2003 1:00 PM
### To: [EMAIL PROTECTED]
### Subject: [PHP] multiple foreach
### 
### 
### 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.
### [EMAIL PROTECTED]   *
### http://xend.net    *
### 602-971-2791
###   *     *       *
### *  *      *__    *    *
###          _/  \___  *
###      *  /   *    \*    *
###       */     * *  \
### *    */\_         |\
###      /   \_      /  \
###     /      \____/    \
###    /                  \ 
###   /                    \
###  /                      \
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net    *
602-971-2791
  *     *       *
*  *      *__    *    *
         _/  \___  *
     *  /   *    \*    *
      */     * *  \
*    */\_         |\
     /   \_      /  \
    /      \____/    \
   /                  \ 
  /                    \
 /                      \


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to