|
 |
|
[มือใหม่ php]รบกวนช่วยตรวจสอบทีค้าบบบบบบ ผมผิดตรงไหน |
|
 |
|
|
 |
 |
|
Code (PHP)
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<?php
$hostname="localhost";
$user="root";
$password="1234";
$dbname="project";
$tbname="member";
mysql_connect($hostname,$user,$password) or die("Not Connection Mysql");
mysql_select_db($dbname) or die("Not Select Date Base");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
if($_POST['username']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุชื่อผู้ใช้งาน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register2.php'>";
}
else if($_POST['password']==""){
echo "<script language='javascript'>";
echo "alert('กรุณาระบุรหัสผ่าน');";
echo "</script>";
echo "<meta http-equiv='refresh' content='0;url=register2.php'>";
}
else{
$sql_insert = sprintf("INSERT INTO member (username,password,id_alumnis,status,perfix,name,lastname,nickname,address,email,tel,tel2,end,present
,study_location,study_faculty,study_branch,study_year,study_money,study_location2,study_faculty2,study_branch2,study_year2,study_money2,award_name
,award_institation,award_year,name_dad,lastname_dad,address_dad,tel_dad,tel2_dad,name_mom,lastname_mom,address_mom,tel_mom,tel2_mom,work,position
,work_location,tel_work,fax_work,present)
VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'
,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",$_POST['username'],$_POST['password'],$_POST['id_alumnis'],$_POST['status'],$_POST['perfix'],$_POST['name'],$_POST['lastname'],$_POST['nickname'],$_POST['address']
,$_POST['email'],$_POST['tel'],$_POST['tel2'],$_POST['end'],$_POST['present'],$_POST['study_location'],$_POST['study_faculty'],$_POST['study_branch']
,$_POST['study_year'],$_POST['study_money'],$_POST['study_location2'],$_POST['study_faculty2'],$_POST['study_branch2'],$_POST['study_year2'],$_POST['study_money2']
,$_POST['award_name'],$_POST['award_institation'],$_POST['award_year'],$_POST['name_dad'],$_POST['lastname_dad'],$_POST['address_dad'],$_POST['tel_dad']
,$_POST['tel2_dad'],$_POST['name_mom'],$_POST['lastname_mom'],$_POST['address_mom'],$_POST['tel_mom'],$_POST['tel2_mom'],$_POST['work'],$_POST['position']
,$_POST['work_location'],$_POST['tel_work'],$_POST['fax_work'],$_POST['present']);
//echo $sql_insert;
$result=mysql_db_query($dbname,$sql_insert);
if(!$result){
echo "<script type='text/javascript'>alert('การสมัครสมาชิกล้มเหลวกรุณาติดต่อผู้ดูแลระบบ')</script>";
echo "<meta http-equiv='refresh' content='0;url=register2.php'>";
}else{
echo"<script type='text/javascript'>alert('การสมัครสมาชิกเสร็จสิ้นเรียบร้อยระบบกำลังพาท่านกลับสู่หน้าหลัก')</script>";
echo "<meta http-equiv='refresh' content='0;url=homepage.php'>";
}
}
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2013-12-14 14:59:40 |
By :
adisorn99 |
View :
795 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พอกรอกข้อมูลลงไปมันขึ้นการสมัครล้มเหลวอ่าครับ
|
 |
 |
 |
 |
Date :
2013-12-14 15:00:43 |
By :
adisorn99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
%s ขาดไปอันนึงครับ ข้อมูลมี 43 คอลัมน์ แต่มี %s แค่ 42 ตัว
|
 |
 |
 |
 |
Date :
2013-12-14 15:53:55 |
By :
K |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo query ออกมาดู แล้วลองเอาไปรันใน phpmyadmin ดูก็ได้ จะได้รู้ว่าผิดตรงไหน
|
 |
 |
 |
 |
Date :
2013-12-14 16:38:30 |
By :
mangkunzo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|