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
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.