Huy
Huy

Reputation: 1

How to avoid saving escape character (\) in db

I'm using zend frame work zend form and zend db for my project.

The problem I have is, when the user enter some special characters in the text field (i.e "I'm"), it is saved in the database with the "\" character (i.e. "I\'"). I need to know how to fix this so it just saved as whatever the user entered.

Upvotes: 0

Views: 780

Answers (3)

Mallika Iyer
Mallika Iyer

Reputation: 710

Use stripslashes(trim($value)); to strip the \ and remove the extra spaces.

Upvotes: 0

Iznogood
Iznogood

Reputation: 12843

http://www.php.net/manual/en/security.magicquotes.disabling.php

If you cannot for any reason disable them you can use stripslashes to strip those \ when getitng the data out of the db before echoing it to the browser.

Upvotes: 0

takeshin
takeshin

Reputation: 50648

You need to disable magic-quotes.

Upvotes: 4

Related Questions