我收到此错误
(语法错误,意外'","'(T_CONSTANT_ENCAPSED_STRING), 期待','或者')'在C:\ xampp \ htdocs \ offline Storage \ online 第14行的form.php
我的代码是......
<?php
if(isset($_POST['first'],$_POST['last'],$_POST['email'],$_POST['fdback']))
{
$conn=mysql_connect("localhost","root","root@localhost");
mysql_select_db("feedback");
$fname=$_POST['first'];
$lname=$_POST['last'];
$eml=$_POST['email'];
$fdb=$_POST['fdback'];
$result=mysql_query("insert into data values(".$fname",".$lname",".$eml",".$fdb")");
if($result)
{
echo "Data Inserted";
}
else
{
echo "Error"
}
};
?>
答案 0 :(得分:0)
在concat的变量之后你错过了点
$result=mysql_query("insert into data values(".$fname. ",".$lname. ",".$eml. ",".$fdb. ")");
但你不应该在sql代码中使用php var ..你有进行sqlinjection的风险..你应该看看你的mysql驱动程序绑定param