<?
$host = "localhost";
$user = "root";
$pass = "1234";
$dbname = "student";
mysql_connect($host,$user,$pass) or die ("ติดต่อ host ไมได้");
mysql_select_db($dbname) or die ("ติดต่อฐานข้อมูลไม่ได้");
mysql_query("SET NAMES TIS620");
//Data From method GET
$extra_job_id=$_GET['extra_id'];
$std_id=$_GET['std_id'];
$del_state=$_GET['del'];
if ($del_state=='True')
{
$sql="DELETE std_extra_job ,student1
FROM std_extra_job INNER JOIN student1 ON std_extra_job.std_id=student1.std_id
WHERE ((std_extra_job.extra_job_id=".$extra_job_id.") AND (student1.std_id=".$std_id."))";
if ($del_state=='True')
{
$sql="DELETE std_extra_job ,student1
FROM std_extra_job INNER JOIN student1 ON std_extra_job.std_id=student1.std_id
WHERE ((std_extra_job.extra_job_id=".$extra_job_id.") AND (student1.std_id=".$std_id."))";
$App= mysql_query($sql);
echo '<script>alert("ลบข้อมูลเรียบร้อยแล้ว");window.location="extra_jobs_data.php";</script>';
}