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(); 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(); 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! Link to comment https://forums.phpfreaks.com/topic/98299-update-queries/#findComment-502993 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.