SunQuest
           Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 9th, 2002, 01:34 PM
replicant replicant is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 2 replicant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry PHP + Access + getting apostrophes to go

I have been having the toughest times getting apostrophes to pass into the database. I hvae tried using str_replace("'","`");
i've tried addslashes($foo); , i've tried ereg_replace, and urlencode.

Nothing seems to work with an access database. Is there an addslashes(); command specific to ms access databases? I'm using PHP + ODBC with an MS Access database.

It was giving errors of missing operators, but now it will pass a \' or a \` but I can't do anything with that record at that point, its almost as if it gets tainted somehow.

I can paste code or whatever is needed.

Any help is so much appreciated.

Last edited by replicant : December 9th, 2002 at 01:36 PM.

Reply With Quote
  #2  
Old December 20th, 2002, 08:13 PM
Sepodati's Avatar
Sepodati Sepodati is offline
Banned
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Dec 1999
Location: Afghanistan
Posts: 14,377 Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 70305 Folding Title: Intermediate FolderFolding Points: 70305 Folding Title: Intermediate FolderFolding Points: 70305 Folding Title: Intermediate FolderFolding Points: 70305 Folding Title: Intermediate Folder
Time spent in forums: 2 Months 3 Weeks 6 Days 21 h 15 m 54 sec
Reputation Power: 1783
Send a message via ICQ to Sepodati Send a message via Yahoo to Sepodati
For access, you may need to escape a single quote with another single quote, rather than a slash.

---John Holmes...

Reply With Quote
  #3  
Old December 21st, 2002, 06:06 AM
Mincer's Avatar
Mincer Mincer is offline
.DOTTY
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: London
Posts: 206 Mincer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 21 m 51 sec
Reputation Power: 6
I would tend to concur with SepodatiCreations. adding slashes is not ANSI sql and will only work in MySQL and PostgresQL. You need to escape each single quote with another single quote.

PHP Code:
// replace one single quote with two single quotes
str_replace"'""''"$foo ) ; 

Reply With Quote
  #4  
Old August 4th, 2003, 11:26 PM
debkumar debkumar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Singapore
Posts: 4 debkumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What if i am using Perl+Sybase...

I want to insert a value from a variable into database...
But the value contains a ' (single quote) which cannot be inserted into the database...
I need to escape it with another '.....
Like for eg
variable x="O'Brien" which has to be "O''Brien".
How can i achieve this in perl?????

I have heard of "DBI placeholder"...but how do i achieve that...

Reply With Quote
  #5  
Old August 5th, 2003, 05:34 AM
Sepodati's Avatar
Sepodati Sepodati is offline
Banned
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Dec 1999
Location: Afghanistan
Posts: 14,377 Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)Sepodati User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 70305 Folding Title: Intermediate FolderFolding Points: 70305 Folding Title: Intermediate FolderFolding Points: 70305 Folding Title: Intermediate FolderFolding Points: 70305 Folding Title: Intermediate Folder
Time spent in forums: 2 Months 3 Weeks 6 Days 21 h 15 m 54 sec
Reputation Power: 1783
Send a message via ICQ to Sepodati Send a message via Yahoo to Sepodati
Why don't you ask in the Perl forum with a new thread (or search there). I'm sure there is a str_replace() similar function in Perl.

---John Holmes...

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > PHP + Access + getting apostrophes to go


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway