0

I'm currently almost done with a new site of mine, but one MySQL insert query is giving me trouble.

The error message I am receiving is : 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 '' at line 2

The code is:

mysql_query("INSERT INTO Conversations (IP_Address, Question, Answer)
VALUES ('$ip', '$storedquestion', '$answer'")or die(mysql_error());

The problem is with the string $answer to my knowledge. It does contains apostrophes and such, but I couldn't get it to change with the real escape string function.

Any ideas?

Thank you,

Resentful

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Resentful
0

try this before inserting:

$answer=addslashes($answer);

It seems to give the same error message.

0

I think doing that makes it reject it because it leaves apostrophes in it.

0

It was missing a ")".

Got to love how the littlest mistakes are so easily missed.

Thank you for all of the help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.