|
|
|
รบกวน Guru ผมต้องการ insert ข้อมูลพร้อมกัน แต่ข้อมูลอยู่ คนล่ะ Table คับ |
|
|
|
|
|
|
|
Code (PHP)
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO tblcustomer (c_name, c_surname, c_numhouse, c_lane, c_road, c_district, c_boundary, c_province, c_numpost, c_telephone, c_email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['c_name'], "text"),
GetSQLValueString($_POST['c_surname'], "text"),
GetSQLValueString($_POST['c_numhouse'], "text"),
GetSQLValueString($_POST['c_lane'], "text"),
GetSQLValueString($_POST['c_road'], "text"),
GetSQLValueString($_POST['c_district'], "text"),
GetSQLValueString($_POST['c_boundary'], "text"),
GetSQLValueString($_POST['c_province'], "text"),
GetSQLValueString($_POST['c_numpost'], "int"),
GetSQLValueString($_POST['c_telephone'], "int"),
GetSQLValueString($_POST['c_email'], "text"));
mysql_select_db($database_hotel, $hotel);
$Result1 = mysql_query($insertSQL, $hotel) or die(mysql_error());
$insertGoTo = "bookingcomplete.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
Tag : PHP, MySQL, HTML/CSS, JavaScript, CakePHP
|
|
|
|
|
|
Date :
2013-06-21 20:26:56 |
By :
ธนกฤต |
View :
651 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้ว คับ
พอดี ลองแก้ ได้เฉยเลย
Code (PHP)
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO tblcustomer (c_name, c_surname, c_numhouse, c_lane, c_road, c_district, c_boundary, c_province, c_numpost, c_telephone, c_email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['c_name'], "text"),
GetSQLValueString($_POST['c_surname'], "text"),
GetSQLValueString($_POST['c_numhouse'], "text"),
GetSQLValueString($_POST['c_lane'], "text"),
GetSQLValueString($_POST['c_road'], "text"),
GetSQLValueString($_POST['c_district'], "text"),
GetSQLValueString($_POST['c_boundary'], "text"),
GetSQLValueString($_POST['c_province'], "text"),
GetSQLValueString($_POST['c_numpost'], "int"),
GetSQLValueString($_POST['c_telephone'], "int"),
GetSQLValueString($_POST['c_email'], "text"));
mysql_select_db($database_hotel, $hotel);
$Result1 = mysql_query($insertSQL, $hotel) or die(mysql_error());
$insertSQL1 = sprintf("INSERT INTO tblreservation (re_numberofro, re_numberofg, re_datein, re_dateout, re_requs) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['re_numberofro'], "int"),
GetSQLValueString($_POST['re_numberofg'], "int"),
GetSQLValueString($_POST['re_datein'], "date"),
GetSQLValueString($_POST['re_dateout'], "date"),
GetSQLValueString($_POST['re_requs'], "text"));
mysql_select_db($database_hotel, $hotel);
$Result1 = mysql_query($insertSQL1, $hotel) or die(mysql_error());
$insertGoTo = "bookingcomplete.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
|
|
|
|
|
Date :
2013-06-21 21:16:25 |
By :
ธนกฤต |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2013-06-22 06:43:18 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|