ec Posted March 28, 2008 Share Posted March 28, 2008 Is it possible to have 2 update queries in the same file?? Both queries work fine with the other one // but won't work once i remove the // This is the code $qry = "SELECT level as level FROM accesslevel WHERE position= '$position' "; $result=mysql_query($qry); $result = mysql_fetch_array($result); $level = $result[0]; $qry = "UPDATE members SET level = '$level' WHERE teacherid = '$teacherid' "; $result = mysql_query($qry) $qry2 = "UPDATE teacher SET position = '$position' WHERE teacherid = '$teacherid' "; $result2 = mysql_query($qry2); //Check whether the queries was successful or not if($result, $result2) { header("location: updatesuccessful.php"); exit(); }else { die("Query failed"); } mysql_close(); Quote Link to comment https://forums.phpfreaks.com/topic/98299-update-queries/ Share on other sites More sharing options...
ansarka Posted March 28, 2008 Share Posted March 28, 2008 check this code $qry = "SELECT level as level FROM accesslevel WHERE position= '$position' "; $result=mysql_query($qry); $result = mysql_fetch_array($result); $level = $result[0]; $qry = "UPDATE members SET level = '$level' WHERE teacherid = '$teacherid' "; $result = mysql_query($qry); $qry2 = "UPDATE teacher SET position = '$position' WHERE teacherid = '$teacherid' "; $result2 = mysql_query($qry2); //Check whether the queries was successful or not if($result && $result2) { header("location: updatesuccessful.php"); exit(); }else { die("Query failed"); } mysql_close(); Quote Link to comment https://forums.phpfreaks.com/topic/98299-update-queries/#findComment-502989 Share on other sites More sharing options...
ec Posted March 28, 2008 Author Share Posted March 28, 2008 that's it...GREAT!! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/98299-update-queries/#findComment-502993 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.