这是我的代码,我得到错误查询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');
答案 0 :(得分:6)
您的查询中有单引号而非反引号。
$query="INSERT INTO userdate('name','city','emailid','pledge','date') VALUES ('$name','$city','$emailid','$comment',NOW())";
应该是:
$query="INSERT INTO userdate(`name`,`city`,`emailid`,`pledge`,`date`) VALUES ('$name','$city','$emailid','$comment',NOW())";