Syntax error (missing operator) in query expression
| From: | AgfTech Lists | Date: | Thu, 15 Apr 2004 23:12:31 +0000 |
| Subject: | Syntax error (missing operator) in query expression | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183577@lists.php.net to get a copy of this message | ||
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