advancedfuture Posted December 12, 2009 Share Posted December 12, 2009 I am trying to limit how many dbconnections I run. How can I combine these two mysql statements into one query.. if possible. //If the user cancels their subscription, deactivate their account and delete their advertisement. if($txn_type == "subscr_cancel") { $query = "UPDATE users SET active='n' WHERE username='$payer_email'"; mysql_query($query); $query = "DELETE FROM advertisements WHERE username='$payer_email'"; mysql_query($query); } Quote Link to comment https://forums.phpfreaks.com/topic/184920-is-it-possible-to-combine-these-two-queries/ Share on other sites More sharing options...
.josh Posted December 12, 2009 Share Posted December 12, 2009 you cannot perform more than 1 full query at a time with mysql_query, however, fyi you are only using 1 db connection to do these two queries. Unless you specifically assign mysql_connect to multiple variables, creating multiple connection resources, and then explicitly specify those diff connection resources in 2nd optional argument of mysql_query, it uses the same connection source. Quote Link to comment https://forums.phpfreaks.com/topic/184920-is-it-possible-to-combine-these-two-queries/#findComment-976197 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.