Jump to content

Insert Into


Solar

Recommended Posts

Error:

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 (comment_id, name, like) VALUES ('102','Steven','1')' at line 1

 

$sql="INSERT INTO like (comment_id, name, like)
VALUES
('$_POST[comment_id]','$_POST[name]','$_POST[like]')";
  
if (!mysql_query($sql,$con))
  {
  die('Error:' . mysql_error());
  }
echo "You have succesfully liked this comment.<br /><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);\">";

mysql_close($con)

 

Table:

comment_idnamelike

 

For some reason, I cannot spot this error. Can you find it? My $con = mysql_connect is a part I left out but it connects fine! The data form is echo'ing fine but it's not inserting into the MySQL Table.

 

Thanks in Advanced!

Link to comment
https://forums.phpfreaks.com/topic/215176-insert-into/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.