tags:

views:

65

answers:

3

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
+1  A: 

use mysql_real_escape_string

— Escapes special characters in a string for use in a SQL statement

$code = mysql_real_escape_string($html_code);
aSeptik
The code you wrote has got nothing to do with urlencode?
Milan Babuškov
i know buddy! it's just a mistake! ;-)
aSeptik
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
A: 

Don't know what you mean, but may be functions like htmlspecialchars() and/or htmlentities() will help.