<?php
	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	
	
	$OBRoomID =$_GET['OBRoomID'];
$result2 = mysql_query("SELECT * FROM onlineroomtrans where OBRoomID='$OBRoomID'");
$row2 = mysql_fetch_array($result2);

$price1 =$row2['price1'];
$price2 =$row2['price2'];
$price3 =$row2['price3'];
$total1 = $row2['total1'];
$total2 = $row2['total2'];
$total3 = $row2['total3'];

$Name = $row2['Name'];
$Username = $row2['Username'];
$IC =$row2['IC'];
$Contact = $row2['Contact'];
$package1 = $row2['package1'];
$people1 = $row2['people1'];
$package2 = $row2['package2'];
$people2 = $row2['people2'];
$package3 = $row2['package3'];
$people3 = $row2['people3'];
$roomtype= $row2['roomtype'];
$total = $row2['Total'];
$date = $row2['date'];
$time = $row2['time'];

$credit = $row2['credit'];
$booktime =$row2['booktime'];
	$query=mysql_query("delete from onlineroomtrans where OBRoomID='$OBRoomID'");
	$query1=mysql_query("INSERT INTO roomtrans(BroomID,Username,Name,IC,Contact,date,time,Total,package1,people1,price1,total1,package2,people2,price2,total2,package3,people3,price3,total3,roomtype,credit,booktime)VALUES
		 ('$OBRoomID','$Username','$Name','$IC','$Contact','$date','$time','$total','$package1','$people1','$price1','$total1','$package2','$people2','$price2','$total2','$package3','$people3','$price3','$total3','$roomtype','$total5','$booktime')");
if($query){
$query2 =mysql_query("UPDATE regmember SET Credit='$credit' where Username='$user' ");
						echo "<script>alert('Submit Successful')</script>";
						  print ("<script>window.close();</script>");


}
						echo "<script>alert('Submit Failed')</script>";
						print ("<script>window.close();</script>");
	
	?>