Prismatic Posted March 26, 2006 Share Posted March 26, 2006 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 :( Quote Link to comment Share on other sites More sharing options...
wickning1 Posted March 26, 2006 Share Posted March 26, 2006 Not really, but PHP's mysqli extension has a mysqli_multi_query() function that sends several queries at once. mysqli is still not supported by a lot of web hosts though. Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted March 26, 2006 Share Posted March 26, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.