Jump to content

combine two mysql updates into one?


HDFilmMaker2112

Recommended Posts

Would there be any feasible way of combining the two Update statement below into one?

 

The Members Table has id, username, password, and application_id

The Application Table has the application id, the users application information and whether or not the application is approved.

 

if($_GET['approved']=="update"){
$approved=$_GET['approved'];
$approved=sanitize($approved);
if($approved=="y"){
$id=(int)$_GET['id'];
$username=$_GET['username'];
$username=sanitize($username);
$password=$_GET['password'];
$password=sanitize($password);
$approved_sql='UPDATE members SET username="$username" password="$password" application_id="$id"';
$approved_result=mysql_query($approved_sql);
$approved_rows=mysql_affect_rows();
$update_approved_sql='UPDATE application SET approved="y" WHERE id="$id"';
$update_approved_result=mysql_query($update_approved_sql);
$update_approved_rows=mysql_affect_rows();
if($approved_rows==1 && $update_approved_rows==1{
header("Location: ./index.php??admincp=investors&view=applications&id=1&approved=updated");
}
}
}

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.