วิธีใช้
ให้นำ code ไปใส่ ก่อน ที่จะมี การ Insert เพื่อให้ระบบไป ตรวจสอบก่อน ว่า ข้อมูลซ้ำ เปล่า
//*** ตรวจสอบข้อมูลซ้ำ
$sql="select * from addot where staff_id='$staff_id' and date='$date' and start_time='$start_time' ";
$result=mysql_query($sql);
if(mysql_num_rows($result)>0)
{
echo "
คุณลงข้อมูลซ้ำ กรุณาลงใหม่
exit();
}
// จบตรวจสอบข้อมูลซ้ำ
$sql="insert into addot values ('$id','$staff_id','$type_id','$date','$start_time','$stop_time','$sum_time','$price','$add_date','$add_date','$note','$status')";
$result = mysql_query($sql);
?>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น