错误:您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,以便在'订单(名称,类型,尺寸,袖子,颜色,数量)附近使用正确的语法(第2行的'猫头鹰','成人','S'
<?php
if (!empty ($_POST)){
if ($_POST ["name"] == NULL){
echo "Enter data."; }
else {
$strname=$_POST["name"];
echo "<p>Name : $strname</p>";
}
if ($_POST ["type"] == NULL){
echo "Enter data."; }
else {
$strtype=$_POST["type"];
echo "<p>Type : $strtype</p>";
}
if ($_POST ["size"] == NULL){
echo "Enter data."; }
else {
$strsize=$_POST["size"];
echo "<p>Size : $strsize</p>";
}
if ($_POST ["sleeve"] == NULL){
echo "Enter data."; }
else {
$strsleeve=$_POST["sleeve"];
echo "<p>Sleeve : $strsleeve</p>";
}
if ($_POST ["color"] == NULL){
echo "Enter data."; }
else {
$strcolor=$_POST["color"];
echo "<p>Color : $strcolor</p>";
}
if ($_POST ["quantity"] == NULL){
echo "Enter data."; }
else {
$strquantity=$_POST["quantity"];
echo "<p>Quantity : $strquantity</p>";
}
$jalinan = mysql_connect("localhost","form2user","1234");
if (!$jalinan)
{
die('No Connection: ' . mysql_error());
}
mysql_select_db("form2", $jalinan);
$sql="INSERT INTO
order(Name,Type,Size,Sleeve,Color,Quantity)
VALUES
('$strname','$strtype','$strsize','$strsleeve','$strcolor','$strquantity')";
if (!mysql_query($sql,$jalinan))
{
die('ERROR: ' . mysql_error());
}
echo "Data saved.";
mysql_close($jalinan);
}
?>