Re: HTML in database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks.  Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function.


Regards,

Bruce

>>> Chris <dmagick@xxxxxxxxx> 5/07/2007 12:10:17 p.m. >>>
Bruce Cowin wrote:
> I am writing code to store a bunch of email files, in MIME format, into a database.  The body of some of these emails, but not all, are in HTML format.  If I use addslashes (after checking get_magic_quotes_gpc()), the database record won't get saved.  There's no error message, just no record saved.  But if I use htmlentities(), it saves the record no problem.
> 
> I would have thought that addslashes would have been enough to format the data correctly.  Why would I need to use htmlentities?  And will using htmlentities cause me any problems?

You shouldn't use either method.

htmlentities is completely changing your data (sure you can change it 
back but you're still changing it from it's original state).

Use mysql_real_escape_string - it handles your quoting and escaping all 
for you.

See http://www.php.net/mysql_real_escape_string 

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux