我写了这个MySQLi查询:
$query = mysqli_query($con,"INSERT INTO listings (cat_id, comp, add, city, zip, state, phone, email, url, payopt, image_path, det1title, det2title, det3title, det1det, det2det, det3det) VALUES ('$cat_id','$comp','$add','$city','$zip','$state','$phone','$email','$url','$payOpt','$image_path','$det1title','$det2title','$det3title','$det1det','$det2det','$det3det')");
它显示错误查询为空。
答案 0 :(得分:4)
按照惯例,绝对没有错误处理,所以你永远不会看到add
是reserved word,需要用反引号引用:
INSERT INTO listings (cat_id, comp, `add`, cit
^---^-- here
永远不要假设查询成功。始终检查失败的返回值,并在事情真正起作用时感到惊喜。