|
 |
|
ช่วยตรวจสอบ code นี้ให้หน่อยนะครับ ข้อผิดพลาดคือ พอลอง insert ข้อมูลลงไปมันจะเข้าเงื่อนไขว่า "'หลักสูตรซ้ำ!! ท่านได้ลงทะเบียนหลักสูตรนี้ไว้แล้วครับ" |
|
 |
|
|
 |
 |
|
ข้อผิดพลาดคือ พอลอง insert ข้อมูลลงไปมันจะเข้าเงื่อนไขว่า "'หลักสูตรซ้ำ!! ท่านได้ลงทะเบียนหลักสูตรนี้ไว้แล้วครับ" แต่พอไปดูใน ฐานข้อมูล ข้อมูลก็ยังถูก insert เข้าไปอยู่ดี แล้วก็ไม่ยอมเช็คค่าซ้ำด้วย ไม่รู้มันผิดตรงไหนครับ ช่วยตรวจสอบให้หน่อยได้มั้ยครับ
Code (PHP)
$title = trim($_POST[T]);
$name = trim($_POST[TFname]);
$lastname = trim($_POST[TLname]);
$position = trim($_POST[Pos]);
if ($position == '-'){
$namepack = "$title$name $lastname";
}
else{
$namepack = "$position$name $lastname";
}
$course = trim($_POST[Cos]);
$address = trim($_POST[Add]);
$phone = trim($_POST[Tel]);
$email = trim($_POST[Em]);
$objConnect = ConnectMySQL ();
$strSQL = "SELECT * FROM traincourse WHERE Fullname = '$namepack' AND Course = '$course ' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo"<body onload=\"window.alert('หลักสูตรซ้ำ!! ท่านได้ลงทะเบียนหลักสูตรนี้ไว้แล้วครับ');\">";
}
else
{
$strSQL = "";
$strSQL = "INSERT INTO traincourse ";
$strSQL .="(Fullname,Course,Institute,Phone,Email,Log) ";
$strSQL .="VALUES ";
$strSQL .="('$namepack','$course','$address' ";
$strSQL .=",'$phone','$email',Now()) ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo"<body onload=\"window.alert('ลงทะเบียนเรียบร้อยแล้วครับ');\">";
}
else
{
echo"<body onload=\"window.alert('เกิดข้อผิดพลาด');\">";
}
}
mysql_close($objConnect);
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-04-08 14:54:16 |
By :
jpepsitanf |
View :
796 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมเจอข้อผิดพลาดแล้วครับ พอมาโพส ก็เจอ เลย ตัวแปร Cos มันไปตรงกับ Cos Sine นี่เอง
ขอบคุณครับ ไม่เห็นตัวแดงๆตอนโพสไปแล้ว ก็ลืมนึกไปเลย
|
 |
 |
 |
 |
Date :
2010-04-08 14:59:25 |
By :
jpepsitanf |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|