HDFilmMaker2112 Posted November 22, 2011 Share Posted November 22, 2011 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 More sharing options...
dreamwest Posted November 22, 2011 Share Posted November 22, 2011 Just use the alias "AS" for each table name. Same process as joining Link to comment https://forums.phpfreaks.com/topic/251602-combine-two-mysql-updates-into-one/#findComment-1290341 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.