爲什麼我在第21行有一個sytax錯誤? (在if($ sql)行)我是新來的,無法弄清楚。我一直在旋轉我的輪子一個小時。對於這裏的大多數人來說,我確信它非常簡單。我找不出語法錯誤
<?php
$conn = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("solera_menu",$conn);
if(isset($_POST['submit']))
{
$file = $_FILES['file']['tmp_name'];
$handle = fopen($file,"r");
while(($fileop = fgetcsv($handle,1000,",")) !==false)
{
$order = $fileop[0];
$category = $fileop[1];
$name = $fileop[2];
$description = $fileop[3];
$price = $fileop[4];
$sql = mysql_query("INSERT INTO dinner (order,category,name,description,price) VALUES ('$order','$category','$name','$description','$price')")
if($sql)
{
echo 'Data Uploaded Successfully';
}
}
}
?>
缺少','的'$ SQL年底= ...'行 – 2013-05-03 21:57:37
看看'mysqli'或' PDO'。 'mysql_ *'已棄用;) – Aquillo 2013-05-03 21:58:11
哇,我很蠢!謝謝馬克。我知道這很簡單! – 2013-05-03 21:58:41