开发者

Error in query while performing insert

开发者 https://www.devze.com 2023-03-28 06:28 出处:网络
this is my code and for which i m getting开发者_如何转开发 error query mssg: $name = mysqli_real_escape_string($dbc, trim($_POST[\'fname\']));

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

精彩评论

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