-1

I have this Error: when i do this update: ERROR: Apostrophe non fermé @ 124 STR: '

update referent set genderReferent='',phoneReferent='',faxReferent='',adressReferent='38, boulevard de l'Ayrolles - B.P. 145',supportOrganization='',zipCode='',cityReferent='',countryReferent='' where oldReferentId=5077 

Erreur de syntaxe près de 'Ayrolles - B.P. 145',supportOrganization='',zipCode='',cityReferent='',countryRe' à la ligne 1

Thanks in advance

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
  • possible duplicate of [How can I prevent SQL-injection in PHP?](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) – Funk Forty Niner Mar 12 '16 at 14:52

1 Answers1

1

You need to add additional ' inside '' for adressReferent:

update referent
set genderReferent='',
    phoneReferent='',
    faxReferent='',
    adressReferent='38, boulevard de l''Ayrolles - B.P. 145',
    supportOrganization='',
    zipCode='',
    cityReferent='',
    countryReferent='' 
where oldReferentId=5077 
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
  • i get that dynamically how can i resolved that issue thanks in advance – kurchi suiden Mar 12 '16 at 14:56
  • @kurchisuiden **You should add PHP code to your question.** Anyway if it is concatenated SQL string you should use parameter binding and special characters will be espaced automatically. – Lukasz Szozda Mar 12 '16 at 14:57