MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Haig Dedeyan (Home) Date:January 13 2007 2:15am
Subject:Re: Problems with INSERT
In-reply-to:
<OFDCD69B34.C99DB58F-ON86257261.0077B2C9-86257261.007825C9@mdacc.tmc.edu>
View as plain text  

dpgirago@stripped wrote:
>
> > 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

Thanks guys for all your input. Greatly appreciated!!

Escaping the single quotes did the trick.

Haig
Thread
Insert ... Select troublesEd Reed11 Jan
  • Re: Insert ... Select troublesBrent Baisley12 Jan
    • Problems with INSERTHome)12 Jan
      • Re: Problems with INSERTChris17 Jan
    • Re: Insert ... Select troublesEd Reed13 Jan
  • Re: Insert ... Select troublesBrent Baisley15 Jan
Re: Insert ... Select troublesEd Reed12 Jan
RE: Problems with INSERTJay Blanchard12 Jan
Re: Problems with INSERTdpgirago12 Jan
Re: Problems with INSERTHome)13 Jan
Re: Insert ... Select troublesEd Reed17 Jan