|
|
|
การQry อย่างนี้ไม่ได้หรอครับ ผมเข้าใจเหมือนกันว่าทำไมไม่ได้ครับ |
|
|
|
|
|
|
|
Code (PHP)
$id = addslashes($_SESSION['id_search']);
$prefix = addslashes($_POST['prefix']);
$first_name = addslashes($_POST['first_name']);
$last_name = addslashes($_POST['last_name']);
$nickname = addslashes($_POST['nickname']);
$room = addslashes($_POST['room']);
$major = addslashes($_POST['major']);
$BD = addslashes($_POST['BD']);
$race = addslashes($_POST['race']);
$nationality = addslashes($_POST['nationality']);
$religion = addslashes($_POST['religion']);
$home_phone = addslashes($_POST['home_phone']);
$cellphone = addslashes($_POST['cellphone']);
$network = addslashes($_POST['network']);
$e_mail = addslashes($_POST['e_mail']);
$facebook = addslashes($_POST['facebook']);
$id_person = addslashes($_POST['id_person']);
if(($nickname != "") && ($major != "") && ($BD != "")
&&($race != "") && ($nationality != "") && ($religion != "")
&& ($cellphone != "") && ($network != "") && ($id_person)){
echo $nickname . $major . $BD ;
$sql = "REPLACE INTO normal VALUES(" ;
$sql .= " $id ,
'$prefix' ,
'$first_name' ,
'$last_name' ,
'$nickname' ,
$room ,
'$major' ,
'$BD' ,
'$race' ,
'$nationality' ,
'$religion' ,
$home_phone ,
$cellphone ,
'$network' ,
'$e_mail' ,
'$facebook' ,
$id_person " ;
$sql .= ");" ;
$qry = mysql_query($sql);
if (!$qry){
echo "<br><br><br><b>" . "ไม่สามารถเพิ่มข้อมูลได้" . "</b>" ;
}
else {
$ruler_name = addslashes($_POST['ruler_name']) ;
$working_ru = addslashes($_POST['working_ru']) ;
$address_ru = addslashes($_POST['address_ru']) ;
$mo_ru = addslashes($_POST['mo_ru']) ;
$building_ru = addslashes($_POST['building_ru']) ;
$room_ru = addslashes($_POST['room_ru']) ;
$lane_ru = addslashes($_POST['lane_ru']) ;
$road_ru = addslashes($_POST['road_ru']) ;
$district_ru = addslashes($_POST['district_ru']) ;
$amphur_ru = addslashes($_POST['amphur_ru']) ;
$province_ru = addslashes($_POST['province_ru']) ;
$PObox_ru = addslashes($_POST['PObox_ru']) ;
$tel_ru = addslashes($_POST['tel_ru']) ;
$sql2 = "REPLACE INTO ruler VALUES(" ;
$sql2 .= " $id ,
'$ruler_name' ,
'$working_ru' ,
$address_ru ,
$mo_ru ,
'$building_ru' ,
$room_ru ,
'$lane_ru' ,
'$road_ru' ,
'$district_ru' ,
'$amphur_ru'
'$province_ru' ,
$PObox_ru ,
$tel_ru " ;
$sql2 .= ");" ;
$qry2 = mysql_query($sql2) ;
if(!$qry2){
echo "<br><br><br><b>" . "ไม่สามารถเพิ่มข้อมูลได้2" . "</b>" ;
}
else{
echo "<script>window.location = 'http://" .$_SERVER['HTTP_HOST'] . "/information_51/datain2.php'</script>" ;
}
}
}
else{
echo "<font color='#FF0000'>ท่านใส่ข้อมูลพื้นฐานไม่ครบไม่ครบสมบูรณ์</font>" ;
}
มันไปเข้า ไม่สามารถเพิ่มข้อมูลได้2 ตลอดเลยอ่ะครับ
Tag : PHP
|
|
|
|
|
|
Date :
2011-11-15 18:05:39 |
By :
lcherrybluel |
View :
791 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$id = addslashes($_SESSION['id_search']);
$prefix = addslashes($_POST['prefix']);
$first_name = addslashes($_POST['first_name']);
$last_name = addslashes($_POST['last_name']);
$nickname = addslashes($_POST['nickname']);
$room = addslashes($_POST['room']);
$major = addslashes($_POST['major']);
$BD = addslashes($_POST['BD']);
$race = addslashes($_POST['race']);
$nationality = addslashes($_POST['nationality']);
$religion = addslashes($_POST['religion']);
$home_phone = addslashes($_POST['home_phone']);
$cellphone = addslashes($_POST['cellphone']);
$network = addslashes($_POST['network']);
$e_mail = addslashes($_POST['e_mail']);
$facebook = addslashes($_POST['facebook']);
$id_person = addslashes($_POST['id_person']);
if($nickname != "" || $major != "" || $BD != "" || $race != "" || $nationality != "" || $religion != "" || $cellphone != "" || $network != "" || $id_person){
$query=mysql_query(" replace into normal value ('$id', '$prefix', '$first_name', '$last_name', '$nickname', '$room', '$major', '$BD', '$race', '$nationality', '$religion', '$home_phone', '$cellphone', '$network', '$e_mail', '$facebook', '$id_person') ");
if (!$query){
echo "<br><br><br><b>" . "ไม่สามารถเพิ่มข้อมูลได้" . "</b>" ;
}
}
else {
$ruler_name = addslashes($_POST['ruler_name']) ;
$working_ru = addslashes($_POST['working_ru']) ;
$address_ru = addslashes($_POST['address_ru']) ;
$mo_ru = addslashes($_POST['mo_ru']) ;
$building_ru = addslashes($_POST['building_ru']) ;
$room_ru = addslashes($_POST['room_ru']) ;
$lane_ru = addslashes($_POST['lane_ru']) ;
$road_ru = addslashes($_POST['road_ru']) ;
$district_ru = addslashes($_POST['district_ru']) ;
$amphur_ru = addslashes($_POST['amphur_ru']) ;
$province_ru = addslashes($_POST['province_ru']) ;
$PObox_ru = addslashes($_POST['PObox_ru']) ;
$tel_ru = addslashes($_POST['tel_ru']) ;
$query2=mysql_query(" REPLACE INTO ruler VALUES ('$id', '$ruler_name', '$working_ru', '$address_ru', '$mo_ru', '$building_ru', '$room_ru', '$lane_ru', '$road_ru', '$district_ru', '$amphur_ru', '$province_ru', '$PObox_ru', '$tel_ru') ");
if(!$query2){
echo "<br><br><br><b>" . "ไม่สามารถเพิ่มข้อมูลได้2" . "</b>" ;
}
else{
echo "<script>window.location = 'http://" .$_SERVER['HTTP_HOST'] . "/information_51/datain2.php'</script>" ;
}
}
}
else{
echo "<font color='#FF0000'>ท่านใส่ข้อมูลพื้นฐานไม่ครบไม่ครบสมบูรณ์</font>" ;
}
เช็คเรื่องคำส่ัง replace ด้วย
เช็คเรื่องการใช้ session ด้วย
เช็คเรื่องเครื่องหมายด้วย ผมเห็นบางที่ก็ไม่ได้ใส่เครื่องหมาย single qoute
ไม่มั่นใจว่าได้ชั่วนะ ก็ลองดูเรื่องการ replace อีกทีแล้วกัน
|
|
|
|
|
Date :
2011-11-15 21:38:28 |
By :
ozma |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|