Re: update more "same" fields at the same time

From: Date: Wed, 15 Jan 2003 13:29:57 +0000
Subject: Re: update more "same" fields at the same time
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-131698@lists.php.net to get a copy of this message
Simon wrote:
with the same data or not?
not with the same data You can put your data and the primary keys in arrays and exec a loop
but the data[0] must be the data for the id[0], data[1] must be the data for id[1] etc. The loop should be something like this: for (int $i=0; $i<=total_records_select_returned -1; $i++) update table set field1='$data[$i]' where id=$id[$i]; I 'm not sure for the syntax but the idea is correct.

« previous php.general (#131698) next »