How can I update several rows in the same table in the one query? There are two columns and I'm using PHP 4.3.2 and MySQL 4.0.13.
nuk3.com | Free funny flash movies and addictive games
How can I update several rows in the same table in the one query? There are two columns and I'm using PHP 4.3.2 and MySQL 4.0.13.
nuk3.com | Free funny flash movies and addictive games
Mark Hensler posted this at 06:42 — 28th July 2003.
He has: 4,044 posts
Joined: Aug 2000
You can only update 2 or more records if you want the fields to be the same. (So you can't update one records with field_one=1 and record two with field_one=2)
Is this the case? If so, just edit the WHERE statement to include some identification for all desired records.
Mark Hensler ["Max Albert"] [Email]
If there is no answer on Google, then there is no question.
nuk3 posted this at 08:16 — 28th July 2003.
He has: 238 posts
Joined: May 2002
Each field will have a different value. So what can I do?
Mark Hensler posted this at 18:56 — 28th July 2003.
He has: 4,044 posts
Joined: Aug 2000
If each record must have seperate values, then you'll have to run a seperate update query for each record. I've not found a way around that for MySQL 3.
MySQL 4, on the other hand, may have other options. I've heard of multi-table updates (similar to select queries with join statements), but I've not read much about them. I don't know if you could update multiple records within one table, but the capability may have been added as well.
Mark Hensler ["Max Albert"] [Email]
If there is no answer on Google, then there is no question.