Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apostrophe in database field

Status
Not open for further replies.

dyedblue

Technical User
Aug 20, 2004
11
0
0
US
Whenever I call a field out of my database that contains an apostrophe it puts a "\" before the apostrophe. How can I prevent this from happening?

example:
print("$name"); it will output "David\'s Drycleaning" rather than "David's Drycleaning"

Thanks in advance for your help
 
Or, when you store the record, store the urlencoded record. When you print, use urldecode.

Ken
 
This feature is called "magic quotes" it will automatically add the slash to anything that won't go into the db. If you are working on another server where they don't have magic quotes enabled, use the addslashes() function before inserting it into the db. then stripslashes() when it comes out. this will ensure that the data is of good quality.

David

David Kuhn
------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top