Jump to content

Multiple Update Vs For Loop


ProblemHelpPlease

Recommended Posts

I am runing the code below and want to apply the update to multiple fields. I was looking at either having multiple UPDATE's or using an array of fields and a looping the UPDATE. Which is the best option in terms of load on server or is their another way? The code alreay loops through several tables containing several 100,000 rows.

mysql_query("UPDATE $tablename SET NAME = REPLACE(NAME,'?','') WHERE NAME LIKE '%?%'");

Link to comment
Share on other sites

If you're updating the entire table the load on the database is going to be about the same regardless of whether or not you batch the queries. If you want to run them all at once, have the PHP script just print the queries out separated by a semicolon and then paste the entire thing into phpMyAdmin to run them all.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...