aliento Posted March 24, 2013 Share Posted March 24, 2013 Hello, i want to know how can i change common sql and html characters at the submit form text boxes and textareas so i can insert them in db. When i enter the ' character it returns sql error also i dont want to insert html into the db. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/276093-change-html-and-mysql-characters-in-text-to-insert-it-to-mysql/ Share on other sites More sharing options...
aliento Posted March 24, 2013 Author Share Posted March 24, 2013 sorry for my bad English i try the best Quote Link to comment https://forums.phpfreaks.com/topic/276093-change-html-and-mysql-characters-in-text-to-insert-it-to-mysql/#findComment-1420757 Share on other sites More sharing options...
PaulRyan Posted March 24, 2013 Share Posted March 24, 2013 You probably need mysql_real_escape_string Quote Link to comment https://forums.phpfreaks.com/topic/276093-change-html-and-mysql-characters-in-text-to-insert-it-to-mysql/#findComment-1420760 Share on other sites More sharing options...
aliento Posted March 24, 2013 Author Share Posted March 24, 2013 Thank you What i put into the db i show it at html pages so how can i avoid closing an html tag like > ? Quote Link to comment https://forums.phpfreaks.com/topic/276093-change-html-and-mysql-characters-in-text-to-insert-it-to-mysql/#findComment-1420762 Share on other sites More sharing options...
PaulRyan Posted March 24, 2013 Share Posted March 24, 2013 You want to display ">"? You use htmlentities when display the data to the user. Take this for example: <?PHP $HTML = '<span> THIS IS HTML </span>'; echo 'Will not display ">" - '. $HTML; echo '<br> ------------------------- <br>'; echo 'Will display ">" - '. htmlentities($HTML); ?> Quote Link to comment https://forums.phpfreaks.com/topic/276093-change-html-and-mysql-characters-in-text-to-insert-it-to-mysql/#findComment-1420763 Share on other sites More sharing options...
Solution aliento Posted March 24, 2013 Author Solution Share Posted March 24, 2013 thank you Quote Link to comment https://forums.phpfreaks.com/topic/276093-change-html-and-mysql-characters-in-text-to-insert-it-to-mysql/#findComment-1420764 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.