Hello,
I added three new fields in the reviews table: name, like, dislike.
I get an error when you add a new comment.
[INSERT INTO `reviews` SET created='1354191586',approved='0',product_name='nettoyeur de vitre wv50',rating='5',comments='blabla',name='greg',like='blabla',dislike='blabla'][You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like='blabla',dislike='blabla'' at line 1]
My code in reviews php:
$sql = "INSERT INTO `".$config_databaseTablePrefix."reviews` SET created='".time()."',approved='0',product_name='".database_safe($q)."',rating='".database_safe($_POST["rating"])."',comments='".database_safe(stripslashes(trim($_POST["comments"])))."',name='".database_safe(stripslashes(trim($_POST["name"])))."',like='".database_safe(stripslashes(trim($_POST["like"])))."',dislike='".database_safe(stripslashes(trim($_POST["dislike"])))."'";
Greg
Hi Greg,
That will be because "like" is a reserved word in MySQL - to fix this, make sure that it is back-ticked in the generated SQL using:
$sql = "INSERT INTO `".$config_databaseTablePrefix."reviews` SET created='".time()."',approved='0',product_name='".database_safe($q)."',rating='".database_safe($_POST["rating"])."',comments='".database_safe(stripslashes(trim($_POST["comments"])))."',name='".database_safe(stripslashes(trim($_POST["name"])))."',`like`='".database_safe(stripslashes(trim($_POST["like"])))."',dislike='".database_safe(stripslashes(trim($_POST["dislike"])))."'";
Cheers,
David.
--
PriceTapestry.com