Here's a question of efficiency.

I have an application in PHP using MySQL.

Users select items on a form and each selected item represents a change in a table row. It is possible that 100s of changes might be chosen from a single form.

Which is likely to be faster/more efficient?

multiple queries like...
$query="UPDATE some_table SET x='$y' WHERE id='$z[$key]'";

or one huge query like...
$query="UPDATE some_table SET x='$y' WHERE id='$z[$key]'
        OR id='$z[$another_key]' OR id='$z[$another_key]
        OR id='$z[$another_key]"; etc?

In the latter, PHP would have to construct the WHERE string, which would require some processing power as well. Is there a limit to how many OR's can be added to a mysql query? No - don't answer that, I'll look in the manual.

Many thanks,


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to