php/mysql problem in string with apostrophe character

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
baskar
Forum Newbie
Posts: 1
Joined: Mon Nov 11, 2002 6:06 am
Contact:

php/mysql problem in string with apostrophe character

Post by baskar »

I can able to insert the string(sundar's) in database field. but when i display that value it displays like sundar//'s . why is it so and how to solve it. Then i am unable to retrieve the record using this string in query

Please help me to solve this
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Use stripslashes() to get rid of the escape character (\) when you are displaying the data from the database.

When you want to test against that record in the database you need to use addslashes() on the string to put the escape characters in.

Mac
Post Reply