' (apostrophe) in SQL challenges...

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

' (apostrophe) in SQL challenges...

Post by KSan » 2013-04-19 17:50

I am having trouble with text that contains ' in some SQL. Example, O'Brians, Macy's etc. Entering 2 x ' in each place where you normally put in 1 ' solves the problem but I don't want to do that. Has anyone successfully tackled this issue? Thanks much for your advice.

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: ' (apostrophe) in SQL challenges...

Post by KSan » 2013-04-20 04:33

str_replace() which is a php function helped me solve my problem. All good.

User avatar
jmcgov
Veteran Member
Posts: 79
Joined: 2018-12-19 01:31
Location: Northern Ireland

Re: ' (apostrophe) in SQL challenges...

Post by jmcgov » 2019-04-13 18:41

Hi
I'm having this issue on new version. Apologies in advance if this question is a bit dunce-like!
- the field that I am trying to save is $data['address1']
- the table is address
- I understand the answer is to either strreplace("'",'', $data['address1']) OR $data['address1'] = addslashes($data['address1']), right?

Is this correct? Where do I add the line?
TIA, JAmes

User avatar
jmcgov
Veteran Member
Posts: 79
Joined: 2018-12-19 01:31
Location: Northern Ireland

Re: ' (apostrophe) in SQL challenges...

Post by jmcgov » 2019-04-13 23:43

Mmh, ignore that :/

Post Reply