开发者

Error in query while performing insert

this is my code and for which i m getting开发者_如何转开发 error query mssg:

 $name = mysqli_real_escape_string($dbc, trim($_POST['fname']));
 $emailid = mysqli_real_escape_string($dbc, trim($_POST['emailid']));
 $city = mysqli_real_escape_string($dbc, trim($_POST['city']));
 $comment = mysqli_real_escape_string($dbc, trim($_POST['comment']));
 $query="INSERT INTO userdate('name','city','emailid','pledge','date') VALUES       ('$name','$city','$emailid','$comment',NOW())";
$result=mysqli_query($dbc, $query) or die('error query'); 


You have single quotes and not backticks in your query.

$query="INSERT INTO userdate('name','city','emailid','pledge','date') VALUES ('$name','$city','$emailid','$comment',NOW())";

Should be:

$query="INSERT INTO userdate(`name`,`city`,`emailid`,`pledge`,`date`) VALUES ('$name','$city','$emailid','$comment',NOW())";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜