Jump to content

Is it possible to combine these two queries?


advancedfuture

Recommended Posts

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);
}

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.

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.