> I keep getting the following 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 's 
> resources than dual monitor mode to generate the video output. Running 
> in dual' at line 2
>
> when I try to add:
>
> Note : Single-monitor mode uses more of your computer's resources than 
> dual monitor mode to generate the video output. Running in dual monitor 
> mode is recommended because it is more efficient.
>
>
> My PHP code to add Q & A is:
>
> mysql_query("INSERT INTO faqs
> (Question, Answer, Category, Date) VALUES('$question', '$answer', 
> '$category', CURDATE() ) ")
> or die(mysql_error()); 
>
> If I enter the above text directly intophpMyAdmin, all is fine.
>
> Any help is greatly appreciated.
>
> Thanks
>
> Haig

Haig,

$questionEscaped = mysql_real_escape_string($question);

mysql_query("INSERT INTO faqs
(Question, Answer, Category, Date) VALUES('$questionEscaped', '$answer', 
'$category', CURDATE() ) ") 
or die(mysql_error());

You need to escape the single quote in your FAQ.

David

Reply via email to