Click to See Complete Forum and Search --> : question: show BLOB type from database


snoopy0877
10-16-2003, 03:24 AM
I have the "Content" fields in database, datatype is blob. In the form for user upload, I have 2 option:

1/ Upload plain text in textarea box
2/ Upload html file in file fields

When I show this data on the browser I want to check:

If "Content" fields have html tag(upload html's file) I 'll show normal echo $Content
If "Content" fields is plain text I ll show by nl2br($Content)


How can I check for this condition, have anyone experience with that problem, pls help me....

pyro
10-16-2003, 07:31 AM
As it appears the reason this is needed is for line breaks, you could just write a regexp that will search the string for <br> (and <br />) and if those are not found, run it through nl2br.

snoopy0877
10-17-2003, 09:13 PM
Thanks for your suggest. But It seem not right because If in the html code not have "<br>" tag???

PunkSktBrdr01
10-17-2003, 10:05 PM
Why not make another field in the table to tell if the file is text or HTML?