littlepeg Posted May 23, 2007 Share Posted May 23, 2007 Hi everybody. I am a new learner for php & MySQL and have one easy question would like to ask for advice. How can I store content in the database when they have some special symbols. For example, one thing I need to store is time: between 12:00am-15:00pm. when I output it using php, it becomes like 12:00am?15:00pm. In addition, the other one is "company's", and this output became company?s. Any help would be grately and appreciated. Link to comment https://forums.phpfreaks.com/topic/52650-please-help-me-with-output-problem/ Share on other sites More sharing options...
emehrkay Posted May 23, 2007 Share Posted May 23, 2007 are those quoes and dashes from a MS product? if they were regular html characters, they should store fine, but if the were of the "smart" variety, the browser would have trouble displaying them and mysql wouldnt understand them either. one you figure that out, use htmlentities and mysql_real_escape_string before storing data Link to comment https://forums.phpfreaks.com/topic/52650-please-help-me-with-output-problem/#findComment-259885 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 if you want... just htmlentities($string,ENT_QUOTES); then all them issues go byebye... Link to comment https://forums.phpfreaks.com/topic/52650-please-help-me-with-output-problem/#findComment-259889 Share on other sites More sharing options...
littlepeg Posted May 23, 2007 Author Share Posted May 23, 2007 Hi, thank you for your reply. My situation is that I stored some web content within a database, and then use php code to display them on the website. So would you please tell me that how do I use this htmlentities($string, ENT_QUOTES)? Link to comment https://forums.phpfreaks.com/topic/52650-please-help-me-with-output-problem/#findComment-259901 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 htmlentities just changes troublesome characters, into their html counterparts... ' -->' " -->" @ -->& and the likes :-) just put that into where you enter stuff into the database, then, everyone's happy... Link to comment https://forums.phpfreaks.com/topic/52650-please-help-me-with-output-problem/#findComment-259916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.