|
![](/images/resource/spacer.gif) |
|
ตรวจข้อมูล ไม่ให้เพิ่มซ้ำ ในตารางสอนทั้งอาจารสอนได้ทีละห้องไม่สามารถไปสอนห้องอื่นในเวลาที่สอนอยู่ได้ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
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
![](/images/adv.jpg?v=1001)
|
ประวัติการแก้ไข 2016-05-30 20:00:10 2016-05-30 20:01:13
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-05-30 19:57:32 |
By :
upvirus |
View :
791 |
Reply :
3 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
sch_date คือ วันที่สอน
sch_time คือ เวลาที่สอน
y_id คือ ปีที่สอน
Sub_id คือ วิชาที่สอน
t_id คือ ครูที่สอน
L_id คือ ชั้นที่เรียน
![ข้อมูลด้านใน ข้อมูลด้านใน](https://www.thaicreate.com/upload/stock/20160530200430.png?v=1001)
|
ประวัติการแก้ไข 2016-05-30 20:09:33
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-05-30 20:07:10 |
By :
upvirus |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
เพิ่ม unique key sch_year sch_day sch_time t_id
sch_day ใช้ ตัวเลข 1-7 เวลาแสดงผลใช้ โปรแกรมช่วย
sch_time เปลี่ยนเป็น period no. ถ้าสอน สองคาบติดกัน ก็ให้เพิ่มอีก 1 record
แล้ว สร้างตาราง map เวลา กับ period_no อีกที
และ ถ้ารวม sch_day sch_time เป็น field เดียวกันได้ก็ดี
ตาราง map คาบเรียน
id day period thai_description time_descript
1 1 1 อาทิตย์คาบเรียนที่1 08:00-09:00
2 1 2 อาทิตย์คาบเรียนที่2 09:00-10:00
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-05-31 05:16:37 |
By :
Chaidhanan |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ขอบคุณคับ เดี๋ยวผมลองทำดู
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-05-31 13:46:58 |
By :
upvirus |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 04
|