Jump to content

Update Queries


ec

Recommended Posts

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

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

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.