I've got an issue with trying to store some affiliate links in my database. They require you to use a linked image so I figured instead of breaking the code up, I'd just put the html code in its entirety into a text field in my MySQL db. For some reason I get nothing out of it when I query it and call it on a webpage with PHP. I've checked with the vendor of the software that I used to create the insert forms and they've covered the addslashes/stripslashes so it can't be that. I guess my question is, is this even possible? Am I storing it in the wrong type of field? (TEXT currently). Any help is appreciated.
I didn't read through this one, but maybe there is something that can help ya. http://forums.digitalpoint.com/showthread.php?t=55161
In some cases, stripslashes may not be enough. I'm using this custom function, i've tested this even with complete 20 K html pages ( worked on some kind of a cache system): function sqlesc($x) { $value = $x; // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } PHP:
they are probably stripping all the html entities including links and tags or something. You can store any type of html in a text or varchar field as long as you don't use some php function to alter it.