refiking Posted August 2, 2010 Share Posted August 2, 2010 What can I do to insert html into the db? Is it a setting on my db field or something? Can't think of anything else it might be. Here's what I've tried from a programming vantage point: 1) addslashes 2) mysql_escape_string 3) mysql_real_escape_string 4) htmlentities All of them provided the same response in the db ultimately. Here is an example entry <p> Hey,</p> <p> How's it goin? I've got a couple surefire upset picks for you. When can we go over them?</p> Quote Link to comment https://forums.phpfreaks.com/topic/209613-help-inserting-html-into-db/ Share on other sites More sharing options...
monkeytooth Posted August 3, 2010 Share Posted August 3, 2010 try setting your tables (rows, columns) or more specifically at least where your storing your html to "utf 8 general case insensitive" You can also make your own filters. Where you find key tags in the HTML you want to convert specificly. and do str_replace type of thing on them when they go into the database and store them like bbcode. then when you pull the info out from the database you reverse the technique to covert your new BB code or version there of to change it back to standard HTML Quote Link to comment https://forums.phpfreaks.com/topic/209613-help-inserting-html-into-db/#findComment-1094407 Share on other sites More sharing options...
refiking Posted August 3, 2010 Author Share Posted August 3, 2010 I figured out something that works (at least for now). Not sure if this is the best method, but I did addslashes(htmlentities($string)) to insert it, then I did stripslashes(html_entity_decode($string)) to retrieve it. Hoep that helps someone else Quote Link to comment https://forums.phpfreaks.com/topic/209613-help-inserting-html-into-db/#findComment-1094408 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.