Re: HTML tags in MySQL

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

 



On Sat, 2007-06-23 at 00:16 -0400, tedd wrote:
> Hi gang:
> 
> I have a client who over the years thought it was great to enter html 
> tags directly into his database via his CMS for display in his web 
> site.
> 
> Now, he has a mess with some data being shown one way, when he wants 
> it shown another. Plus, not all the tags are well formed and some are 
> even malformed (i.e., <b ).
> 
> So, what to do is the question?
> 
> Is there an easy way to scrub the data to remove tags; or is this 
> going to be one of those "change it where you see it" in the CMS; or 
> do I just scrub the data after I extract it from the dB and before 
> displaying it and forget about fixing the dB?
> 
> Recommendations and suggestions welcomed.

Could probably use the tidy lib:

    http://ca.php.net/manual/en/ref.tidy.php

To clean up the tags.

Alternatively strip_tags, and strip them all.

This will do nothing for malformed tags like <b, and rightly so, who's
to say that's not part of an equation :) There's nothing wrong with
putting HTML into a database, in fact it's probably better so that in
the event you want to display it as HTML you can, and in the event you
don't you can scrub as you now wish to do :B

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
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