|
|
|
เกี่ยวกับการทำ multiple insertครับ รบกวนช่วยดูหน่อยครับ |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
for($i=1;$i<=$_POST["hdnLine"];$i++)
{
if($_POST["txtCustomerID$i"] != "")
{
$strSQL = "INSERT INTO customer ";
$strSQL .="(CustomerID,Name,Email,CountryCode,Budget,Used) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtCustomerID$i"]."','".$_POST["txtName$i"]."', ";
$strSQL .="'".$_POST["txtEmail$i"]."' ";
$strSQL .=",'".$_POST["txtCountryCode$i"]."','".$_POST["txtBudget$i"]."', ";
$strSQL .="'".$_POST["txtUsed$i"]."') ";
$objQuery = mysql_query($strSQL);
}
}
echo "Save Done. Click <a href='phpMySQLListRecord.php'>here</a> to view.";
mysql_close($objConnect);
?>
</body>
</html>
Go to : PHP MySQL Add/Insert Multiple Record
|
|
|
|
|
Date :
2011-09-05 21:53:16 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับเด๋วจะลองดู
|
|
|
|
|
Date :
2011-09-05 21:55:18 |
By :
palapoom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|