 |
อยากจะขอให้ผู้รู้ช่วยดูโค้ดให้หน่อยคับ mysql_connect($host,$user,$password)or die ("ติดต่อฐานข้อมูลไม่ได้"); |
|
 |
|
|
 |
 |
|
Code PHP
mysql_connect($host,$user,$password)or die ("ติดต่อฐานข้อมูลไม่ได้");
mysql_select_db($dbname) or die ("ติตต่อฐานข้อมูลไม่ได้");
$sql="select * from employee where generation='select7' and branch='select6' and
date='date' and month='select2' and year='select3' and time='select4' ";
$sqlquery = mysql_db_query( $dbname,$sql );
if($sqlquery==""){
echo "<script>alert('มีลูกค้าจองแล้ว');</script>";
}else{
echo "<script>alert('ยังไม่มีการจอง ');</script>";
}
mysql_close();
ปัญหาคือว่า กรอกข้อมูลลงฐานข้อมูล แต่ข้อมูลที่กรอกมีอยู่ในฐานข้อมูลอยู่แล้วทำไมมันยังกรอกได้คับ แนะนำหน่อย(ถ้ามีตัวอย่างก้อคงดี)
นี้คือฐานข้อมูล
$insertSQL = sprintf("INSERT INTO employee (generation, familyname, tel, email, `date`, `month`, `year`, `time`, province, branch) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['select7'], "text"),
GetSQLValueString($_POST['textfield'], "text"),
GetSQLValueString($_POST['textfield2'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['date'], "text"),
GetSQLValueString($_POST['select2'], "text"),
GetSQLValueString($_POST['select3'], "text"),
GetSQLValueString($_POST['select4'], "text"),
GetSQLValueString($_POST['select5'], "text"),
GetSQLValueString($_POST['select6'], "text"));
ขอขอบคุณไว้ร่วงหน้าเลยนะคับ
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-01-08 09:53:52 |
By :
cmdping |
View :
1031 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|