<?php

	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');

	mysql_selectDB("wauhaha_karaoke",$login);
	
	
	$ProID =$_GET['ProID'];
	$ProName =$_POST['ProName'];
	$ProRQuan =$_POST['ProRQuan'];
	$p = $_POST['p'];
	$result=mysql_query("select * from stock where ProID='$ProID' ");
	$row=mysql_fetch_array($result);
	$SupID=$row['SupID'];
	$query=mysql_query("UPDATE stock Set ProName='$ProName',ProPrice='$p' where ProID='$ProID'");
	$query2=mysql_query("UPDATE stocktran Set ProName='$ProName',ProRQuan='$ProRQuan' where ProID='$ProID'");
	
	if($query){
		echo "<script language=javascript>alert('Update successful!!');window.location='http://www.wauhaha.com/karaoke/addstock.php?SupID=$SupID'</script>";
}
echo "<script language=javascript>alert('Update fail!!');window.location='http://www.wauhaha.com/karaoke/addstock.php?SupID=$SupID'</script>";
	
	
	
	?>