Re: Syntax error (missing operator) in query expression
| From: | AgfTech Lists | Date: | Fri, 16 Apr 2004 03:32:00 +0000 |
| Subject: | Re: Syntax error (missing operator) in query expression | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183585@lists.php.net to get a copy of this message | ||
Got it from there!
Thanks!
Regards
Aman
On Thu, 2004-04-15 at 18:27, Marek Kilimajer wrote:
> This answers it all: http://sk.php.net/addslashes#28429
>
> AgfTech Lists wrote:
> > Hi All
> >
> > Following is the INSERT statement I am executing,
> >
> >
> > <<<<<<<<<<<< snip
> > >>>>>>>>>>>>>>
> >
> > INSERT INTO customer (email, password, handle, fname, lname, company,
> > tax_id, addr1, addr2, city, state, zipcode, country, dayphone, evephone,
> > fax, paymethod, cardname, cardnum, expmonth,expyear ,ship_addr1,
> > ship_addr2,ship_city ,ship_state,ship_zipcode ,ship_country, [date],
> > hear_about_us, mailing_list, email_notification)
> > VALUES('chocsforu@yahoo.com', 'aman', 'none'
> > ,'Am\'an' ,'raheja' ,'',''
> > ,'1317','esid' ,'edw','IL'
> > ,'62025','USA' ,'6186550690','' ,'','VS'
> > ,'Am\'an Raheja','4111111111111111' ,05,06
> > ,'','' ,'','00','','USA',
> > '2004-04-15 18:05:50', '', 'Y', 'Y');
> > <<<<<<<<<<<< snip
> > >>>>>>>>>>>>>>
> >
> >
> > I get the following error. This only happens when I am using the single
> > quotes in the insert statement ( In the above example I am using the
> > single quote twice, but the error occurs even when I use it once)
> >
> > <<<<<<<<<<<< snip
> > >>>>>>>>>>>>>>
> > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax
> > error (missing operator) in query expression ''Am\'an'
> > ,'raheja' ,'',''
> > ,'1317','esid' ,'edw','IL'
> > ,'62025','USA' ,'6186550690','' ,'','VS'
> > ,'Am\'an Raheja''., SQL state 37000 in SQLExecDirect in
> > C:\website\code\register_customer.php on line 196
> > <<<<<<<<<<<< snip
> > >>>>>>>>>>>>>>
> >
> >
> > I tried addslashes() and the INSERT looked like this, which didn't help
> > anyway, besides putting redundant escape characters.
> >
> >
> > <<<<<<<<<<<< snip
> > >>>>>>>>>>>>>>
> > INSERT INTO customer (email, password, handle, fname, lname, company,
> > tax_id, addr1, addr2, city, state, zipcode, country, dayphone, evephone,
> > fax, paymethod, cardname, cardnum, expmonth,expyear ,ship_addr1,
> > ship_addr2,ship_city ,ship_state,ship_zipcode ,ship_country, [date],
> > hear_about_us, mailing_list, email_notification)
> > VALUES('chocsforu@yahoo.com', 'aman', 'none'
> > ,'Am\\\'an' ,'raheja'
> > ,'','' ,'1317','esid'
> > ,'edw','IL' ,'62025','USA'
> > ,'6186550690',''
> > ,'','VS' ,'Am\\\'an
> > Raheja','4111111111111111' ,05,06 ,'',''
> > ,'','00','','USA', '2004-04-15
> > 18:05:50', '', 'Y', 'Y');
> > <<<<<<<<<<<< snip
> > >>>>>>>>>>>>>>
> >
> >
> > Will greatly appreciate suggestions!
> > Regards
> > Aman
> >
______________________
Aman Raheja
AGF Technologies
http://www.agftech.com
______________________