Hi All,

I cannot seem to figure out this one.

I have the following php code in a form:

<input name="id[]" type="hidden" value="<? echo $arr_items
['fld_prod_id']; ?>" />
<input name="qty[]" type="text" class="numAlign" id="qty" value="<? 
echo $arr_items['fld_qty']; ?>" size="3" maxlength="4" />

When the form is posted, it runs the update_cart function (see 
below) to update the cart contents for each item. When I echo the 
for loop it returns the right paramaters, but when I run the UPDATE 
SQL statement it empties the table. However, when I run the the SQL 
statement in the MySQL Cmd prompt it works. 

I am hoping some of you experts can help.

Thanks,
Greg

function update_cart($arr){

$db = New DB;
$max = count($arr[id]);
for($i=0; $i<$max; $i++){
 $id = $arr[id][$i];
 $qty = $arr[qty][$i];
 validate_qty($qty);
 $sql = $db->query("
                UPDATE
                 tbl_cart_items
                SET
                 fld_qty = '$qty',
                 fld_date = now()
                WHERE
                 fld_cart_id = '$_COOKIE[cart_id]'
                AND
                 fld_prod_id = '$id'
                ")
                or $db->PrintErrors();
}       
return true;
}







The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to