how to prevent error of " ' " when input text?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

how to prevent error of " ' " when input text?

Post by valen53 »

somethin like when we key in " didn't " in the textfield. how to prevent
" ' " occur error ? i just know add \ before ' . but when we insert data, how we know user will type ' ? any method can be prevent it ?
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

string addslashes ( string str)


Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

stripslashes

Post by phpScott »

when using addslashes don't for to use the opposite command of stripslashes other wise you could end up in slash hell.

phpScott
Post Reply