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
https://forums.phpfreaks.com/topic/251602-combine-two-mysql-updates-into-one/
Share on other sites

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.