Welcome Guest, Not a member yet? Register   Sign In
Multiple update query
#1

[eluser]snakeblu[/eluser]
Hi everybody,
I have the following code:
Code:
foreach ($data['option'] as $option){
   echo $option['product_option_value'];
   $this->db->query('UPDATE product_option_value SET quantity = (quantity - 1) WHERE product_option_value_id = ' . $option['product_option_value']);
}

The problem is that this code updates only one row even though the array ($data['option']) contains more than one options.

If I add a sleep inside foreach and after the query (for example sleep(3)) the code performs X query, where X is the lenght of array.

It could be a bug?
(sorry for my bad english)

Thanks

Regards
Mauro


Messages In This Thread
Multiple update query - by El Forum - 07-10-2012, 09:45 AM
Multiple update query - by El Forum - 07-10-2012, 03:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB