Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

insert & update in two differnt table

$
0
0
Please, I'm have problem with this. I'm trying to insert into a table allocate and update a table rooms. So that every room occupied will not show on the dropdown menu. Thanks

if (isset($_POST['submit']))
{
	$queryA =  "INSERT INTO allocate(surname, firstname, regno, gender, dept, year, hostel, rooms) VALUES('".$_SESSION['surname']."','".$_SESSION['firstname']."','".$_SESSION['regno']."','".$_SESSION['gender']."', '".$_SESSION['dept']."', '".$_SESSION['year']."', '".$_SESSION['hostel']."', '".$_POST['rooms']."') ";
	/*"SELECT * FROM rooms".
	"WHERE  name ='".$_POST['rooms']."'";*/
	
	$resultA = mysql_query($queryA) or die(mysql_error());
	
	if ($resultA)
	{
		$occupied = 'occupied';
		$queryA1 ="UPDATE rooms".
			"SET status = '".$occupied."'" .
			"WHERE name = '".$_POST['rooms']."'";
		
		$resultA1 = mysql_query($queryA1) or die (mysql_error());
	}
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>