PDA

View Full Version : save text with single quote


arif_laksito
03-15-2004, 01:05 AM
I have a problem with save string in DB, when i save use single quote(') then data become(\')
//real string
$a="You'll find more information to help you ";

//after save
print"$a";
//result =You\'ll find more information to help you

please... help me!

azlatin2000
03-15-2004, 11:51 AM
Php escapes quotes do that sql injection is harder. For example you have a login form and your sql is this:
select * from users where un='$user' or pass = '$pass'

then imagiung if somone entered ' or ''='
for the username and pass then the sql would look like :
select * from users where un='' or ''='' or pass = '' or ''=''

that would be very insecure. There is a thing in php.ini to turn it off though.