Reputation: 45
I wrote this MySQLi Query:
$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')");
It shows the Error Query Empty.
Upvotes: 0
Views: 58
Reputation: 360632
As per usual, there is absolutely NO error handling, so you will never see that add
is a reserved word and needs to be quoted with backticks:
INSERT INTO listings (cat_id, comp, `add`, cit
^---^-- here
Never ever assume a query is succeeding. Always check return values for failure, and be pleasantly surprised when things actually work.
Upvotes: 4