I am trying to read a html file which is a plain page with nothing but and tags in it. I'm using a function to return what is between each tag . . I can echo this to the page fine, but when I try to insert into the database the information is scattered. Any recommendations?
A:
Not sure what you mean by scattered. Depending on the management tool, it may take on the HTML formatting. I have seen this in shared hosting servers where there is a web based management tool.
Make sure your are HTML encoding!
Dustin Laine
2010-03-18 18:49:26
+1
A:
— Escapes special characters in a string for use in a SQL statement
$code = mysql_real_escape_string($html_code);
aSeptik
2010-03-18 18:50:03
The code you wrote has got nothing to do with urlencode?
Milan Babuškov
2010-03-18 18:51:34
i know buddy! it's just a mistake! ;-)
aSeptik
2010-03-18 18:58:17
IMHO, this is the BEST answer. `htmlentities()` and the like are for OUTPUT, not database input; what you want to do is mres the html content so that it comes out of the database exactly how it went in.
Brian Lacy
2010-03-18 19:09:05