Jump to content

Multiple update / insert's in one query?


Prismatic

Recommended Posts

So on my forums I notice I am using a lot of queries to get what I need done, which is not so good in practice. Is there a wat to update or insert different data into multiple tables using one query? (Updates and inserts in different queries) ? Not sure if it's even possible :(
Link to comment
https://forums.phpfreaks.com/topic/5839-multiple-update-inserts-in-one-query/
Share on other sites

The best thing you can do here ( involves a bit more work) is to re-think your code, see if you can't get all the insert/update data in one place so you only have to run 1, possibly 2 queries per table.

This depends on what your doing but if it's a placement issue that causes you to run 2 queries on the same table you can throw some data into a temporary $_SESSION, then extract it from the array when your ready to run the query, that can help cut down on the amount of queries.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.