Actually, why not buffer the sql statements and perform all of them in one query?
You can do more than one statement can't you?
Of course, even if you can do that, I have no idea what would happen if it failed in the middle somewhere for some reason...
shrug I don't think you can update one table from another.
hmmm
UPDATE one FROM two SET (one.food = two.new) WHERE one.food = two.old;
I don't suppose that works?
or UPDATE one INNER JOIN one, two...
foreach($VALUES as $Old=>$New)
{
$sqlUpdate = $sqlUpdate1 . $New . $sqlUpdate2 . $Old . $sqlUpdate3;
}
$mysql_query($sqlUpdate);
// instead of
foreach($VALUES as $Old=>$New)
{
$sqlUpdate = $sqlUpdate1 . $New . $sqlUpdate2 . $Old . $sqlUpdate3;
$mysql_query($sqlUpdate);
}
I think you are stuck.
I found this comment on the mysql site:
Greg Gray: UPDATE a table from another table : A simple example I've looked for at least 5 times and have had to relearn every time -- Q -- I've got students.id, students.class_id and classes.class_id, classes.count_of_students I want to count the number of times each class_id shows up in the students table and put it in the record for that class in the classes table. (Just to make sure my incrementing process is working right in my front end.) A -- CREATE TABLE s_counts SELECT class_id, count (class_id) as count FROM students GROUP BY class_id.......CREATE TABLE new_classes SELECT c.class_id, s.count FROM classes as c, s_counts as s WHERE c.class_id = s.class_id.....ALTER TABLE classes RENAME classes_old ..... ALTER TABLE new_classes RENAME classes ..... This scoop, switch, drop works to UPDATE a table from another table.... but is this the "professional" or "accepted" way to do it?