 |
|
Code (PHP)
<?
include "phpconfig.php";
$sch_date = $_POST['sch_date'];
$sch_time = $_POST['sch_time'];
$y_id = $_POST['y_id'];
$Sub_id = $_POST['Sub_id'];
$t_id = $_POST['t_id'];
$L_id = $_POST['L_id'];
if($sch_id == ""){
$sql1="SELECT * FROM schedule where sch_id='$sch_id'";
$result1 = mysql_query($sql1,$conn);
$total1 = mysql_num_rows($result1);
if($total1 == ""){
$sql = "INSERT INTO schedule (sch_id,sch_date,sch_time,y_id,Sub_id,t_id,L_id)
VALUES('$sch_id','$sch_date','$sch_time','$y_id','$Sub_id','$t_id','$L_id')";
mysql_query($sql,$conn)
or die("3.ไม่สามารถเประมวลผลคำสั่งได้") . mysql_error();
mysql_close($conn);
?>
<script language="javascript">
alert('บันทึกข้อมูลเรียบร้อยแล้ว');
window.location = 'showsubject.php';
</script>
<?
}
else{
?>
<script language="javascript">
alert('ข้อมูลซ้ำ');
window.history.go(-1);
</script>
<?
}
}
else{
?>
<script language="javascript">
alert('ผิดพลาด!');
window.history.go(-1);
</script>
<?
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
Tag : PHP, MySQL, HTML/CSS
|
ประวัติการแก้ไข 2016-05-30 20:00:10 2016-05-30 20:01:13
|
 |
 |
 |
 |
Date :
2016-05-30 19:57:32 |
By :
upvirus |
View :
822 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |