Jump to content

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.

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.