PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
My grasp of mySQL is just strong enough to do the things I need to do, so please bear with me.
I need to send multiple update queries to mySQL (updating a range of records won't do here), and I was wondering if it was possible to send them all at once rather than individually. I tried separating the queries with semi-colons in a variable called $q and then doing
Perfect. I tried searching for IN() on the mySQL doc page, because I figured it would be something like this, but as you can imagine my search results were useless.
mysql_query("UPDATE `table` SET `foo` = '$bar'") or die(mysql_error());
That would update all the records in the table. If you have a specific condition you need to update on, like where first name = bob, something like this would do:
mysql_query("UPDATE `table` SET `foo` = '$bar' WHERE `firstname` = 'bob'") or die(mysql_error());
Hope that helps.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Thanks, Scott, but the IN() solution worked for me. I wasn't updating every record, so the first option wouldn't have sufficed, and the second option wouldn't have worked either, because the records I was updating didn't have anything obviously in common.