 |
ขอถามหน่อยครับ มันขึ้นว่าแบบนี้ให้ทำไงครับ error=insert into register values |
|
 |
|
|
 |
 |
|
ผมออกแบบ from แล้วต้องการแทรงไปใน DB แต่มันขึ้นว่า error=insert into register values ควรเช็กจากอะไรได้บ้างครับ
?
include("connect.php");
$logname = $_POST['logname'];
$password = $_POST['password'];
$confirm = $_POST['confirm'];
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$gender = $_POST['gender'];
$radiogroup =$_POST['radiogroup'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$faith = $_POST['faith'];
$nationality = $_POST['nationality'];
$origin = $_POST['origin'];
$onhome = $_POST['onhome'];
$moo = $_POST['moo'];
$building = $_POST['building'];
$road = $_POST['road'];
$district = $_POST['district'];
$amphur = $_POST['amphur'];
$province = $_POST['province'];
$zip = $_POST['zip'];
$tel = $_POST['tel'];
$mobile = $_POST['mobile'];
$startwork = $_POST['startwork'];
$site = $_POST['site'];
$part = $_POST['part'];
if(empty($logname)||empty($password)||empty($confirm)||empty($name)||empty($lastname)||empty($gender)||empty($radiogroup)||empty($faith)||empty($nationality)||empty($origin)||empty($onhome)||empty($district)||empty($amphur)||empty($province)||empty($zip)||empty($startwork)||empty($site))
{
echo "<script>alert('กรอกข้อมูลให้ครบด้วยคร๊าบ');history.back();</script>";
exit();
}
if($password != $confirm)
{
echo "<script>alert('ตรวจสอบ PASSWORD ด้วยคร๊าบ');history.back();</script>";
exit();
}
if(!checkdate($month,$day,$year))
{
echo "<script>alert('ตรวจสอบ BIRTHDAY ด้วยคร๊าบ');history.back();</script>";
exit();
}
$sqlchk = "select * from register where logname='$logname'";
$querychk = mysql_query($sqlchk) or die("error=$sqlchk");
$numchk = mysql_num_rows($querychk);
if($numchk != 0)
{
echo "<script>alert('กรุณาเปลี่ยน USERNAME ด้วยคร๊าบ');history.back();</script>";
exit();
}else
{
$sql= "insert into register values('','$logname','$password','$name','$lastname','$gender','$radiogroup','$day','$month','$year','$faith','$nationality','$origin','$onhome','$moo','$building','$road,'$district','$amphur','$province','$zip','$tel','$mobile','$startwork','$site','part')";
mysql_query($sql) or die("error=$sql");
echo "<script>alert('Complete');window.location='index.php';</script>";
}
?>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
20 ส.ค. 2550 14:03:47 |
By :
kang001 |
View :
1644 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตรวจสอบว่า
$sql= "insert into register values('','$logname','$password','$name','$lastname','$gender','$radiogroup','$day','$month','$year','$faith','$nationality','$origin','$onhome','$moo','$building','$road,'$district','$amphur','$province','$zip','$tel','$mobile','$startwork','$site','part')";
ตรงกับที่สร้างตารางไว้ในฐานข้อมูลหรือเปล่า
จำนวน field ในตารางนี้ ในฐานข้อมูล ต้องเท่ากับ 26 ช่อง
|
 |
 |
 |
 |
Date :
20 ส.ค. 2550 17:52:21 |
By :
cyberskyclub |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|