我正在尝试做一个联系表单板,我想在数据库中设置read = 0但是每当我尝试时我都有mysqli错误。
Warning: mysqli_query(): Empty query in C:\xampp\htdocs\v2\contactform\contact.php on line 14
第14行是:
if(mysqli_query($conn,$result)){
这是整个代码:
<?php
include("../../includes/db.php");
if(isset($_POST))
{
$contact_name=mysqli_real_escape_string($conn,$_POST["name"]);
$contact_email=mysqli_real_escape_string($conn,$_POST["email"]);
$contact_subject=mysqli_real_escape_string($conn,$_POST["subject"]);
$contact_message=mysqli_real_escape_string($conn,$_POST["message"]);
$read=0;
$result = mysqli_query($conn,"INSERT INTO contact_messages (contact_name,contact_email,contact_subject,contact_message,read,contact_date) values('$contact_name','$contact_email','$contact_subject','$contact_message','$read',now())");
if(mysqli_query($conn,$result)){
echo "Your message has been not sent. Please try again.";
}else{
echo "Your message has been sent.";
}
}
?>
当我删除read = 0并将其从查询中删除它的工作但是当它在那里它不工作时......我无法理解为什么..