【发布时间】:2015-10-10 03:57:57
【问题描述】:
你好,我的 php 有问题,只有行中的最后一个值被插入到 mysql 数据库中:Last value inserted from rows
mysql database only show the last value to be inserted from insert record
我希望插入的三个数据不仅是最后一个值...我该怎么做?
这是我的插入记录行为代码:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO ordering (productCode, Name, paymentMethod, Quantity, TotalPrice) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['productcode'], "int"),
GetSQLValueString($_POST['Name'], "text"),
GetSQLValueString($_POST['PaymentMethod'], "text"),
GetSQLValueString($_POST['quantity'], "int"),
GetSQLValueString($_POST['totalprice'], "double"));
mysql_select_db($database_perfume_connection, $perfume_connection);
$Result1 = mysql_query($insertSQL, $perfume_connection) or die(mysql_error());
$insertGoTo = "member_perfume_homepage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
【问题讨论】: