iceblox Posted June 4, 2009 Share Posted June 4, 2009 Hi Guys, Im trying to find out how to change a " into " but im not sure how to go about it; I thought this was achieved by using htmlspecialchars() but it doesnt seem to be doing the job. Is someone able to point out where i may be going wrong please? This is what i have so far; $val = htmlspecialchars($value, ENT_QUOTES); Link to comment https://forums.phpfreaks.com/topic/160911-in-my-script-that-i-need-to-sort/ Share on other sites More sharing options...
Mark Baker Posted June 4, 2009 Share Posted June 4, 2009 How are you testing whether it's worked? Don't tell me you're displaying the result in a browser. If so, do a view source rather than simply looking at the browser window Link to comment https://forums.phpfreaks.com/topic/160911-in-my-script-that-i-need-to-sort/#findComment-849190 Share on other sites More sharing options...
iceblox Posted June 4, 2009 Author Share Posted June 4, 2009 Im not testing it in the browser as that of code is being using in an insert. For example i have this string Elonex 10" Screen I use code that i posted and in the mysql its being posted as Elonex 10 and thats it.. Do you think it may be a problem with my insert? Thanks, Phil Link to comment https://forums.phpfreaks.com/topic/160911-in-my-script-that-i-need-to-sort/#findComment-849194 Share on other sites More sharing options...
gevans Posted June 4, 2009 Share Posted June 4, 2009 Retrieve it from the db and print it to screen, the " will probably be there (maybe) Link to comment https://forums.phpfreaks.com/topic/160911-in-my-script-that-i-need-to-sort/#findComment-849200 Share on other sites More sharing options...
Mark Baker Posted June 4, 2009 Share Posted June 4, 2009 Escape any quotes in a string that your'e going to store in the database using the appropriate database function rather than using htmlspecialchars(), e.g. mysql_escape_string() or mysql_real_escape_string() Link to comment https://forums.phpfreaks.com/topic/160911-in-my-script-that-i-need-to-sort/#findComment-849242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.