|
 |
|
อยากทราบวิธีการอัพข้อมูลที่ถูกแก้ไขลง SQL ที่ละหลายๆ Table ทำยังไงหรอครับ |
|
 |
|
|
 |
 |
|
ผมต้องการอัพข้อมูลเด็ก และ ข้อมูล ผู้ปกครองที่ถูกทำการแก้ไข พร้อมกันนะครับ ผมลองทำแบบ แยกอัพทีละชุดคำสั่ง แล้วมันอัพให้แต่ข้อมูลเด็ก ข้อมูลผุ้ปกครองไม่อัพให้ นะครับ
Code (PHP)
$strSQL = "UPDATE child SET child_ID = '".trim($_POST['txtchild_ID'])."',child_fname = '".trim($_POST['txtchild_fname'])."',child_lname = '".trim($_POST['txtchild_lname'])."',child_sex = '".trim($_POST['txtchild_sex'])."',child_bd = '".trim($birth)."',child_bld = '".trim($_POST['txtchild_bld'])."',child_cond = '".trim($_POST['txtchild_cond'])."',child_allrg = '".trim($_POST['txtchild_allrg'])."' WHERE(child_ID LIKE '%".$_GET["child_ID"]."%')";
$objQuery = mysql_query($strSQL);
$strSQL = "UPDATE father SET f_ID = '".trim($_POST['txtf_ID'])."',f_fname = '".trim($_POST['txtf_fname'])."',f_lname = '".trim($_POST['txtf_lname'])."'f_nadd = '".trim($_POST['txtf_nadd'])."',f_sadd = '".trim($_POST['txtf_sadd'] )."',f_madd = '".trim($_POST['txtf_madd'])."',f_rdadd = '".trim($_POST['txtf_rdadd'])."',f_tadd = '".trim($_POST['txtf_tadd'])."',f_aadd = '".trim($_POST['txtf_aadd'])."',f_jadd = '".trim($_POST['txtf_jadd'])."',f_idadd = '".trim($_POST['txtf_idadd'])."',f_tel = '".trim($_POST['txtf_tel'])."',f_carr = '".trim($_POST['txtf_carr'])."',child_ID = '".trim($_POST['txtchild_ID'])."' WHERE(child_ID LIKE '%".$_GET["child_ID"]."%')";
$objQuery = mysql_query($strSQL);
ทำยังไงถึงจะอัพข้อมูลทั้ง2Table พร้อมๆกันได้มั่งครับ รบกวนชี้แนะด้วยครับขอบคุณ
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2014-05-31 09:43:46 |
By :
puttisak |
View :
661 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำไมถึงต้องอัพพร้อมๆกันด้วยครับ ปกติก็ทำงานทีละคำสั่งนะครับ ที่อัพเดตไม่ได้เพราะเกิดข้อผิดพลาดรึเปล่า
echo mysql_error()."<br>$strSQL";
|
 |
 |
 |
 |
Date :
2014-05-31 10:22:15 |
By :
{Cyberman} |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|