so if you want to use the PHP function HTMLENTITIES then you call it BEFORE saving the data inside the db, or wherever the data is going to reside. when you need to consume the data remember to unpack / unencode encoded data witht he PHJP function HTML_ENTITY_DECODE as to
how you display ONLY the first 20 characters in a column called message thats up to you.
you could truncate the string in the DB or in PHP
..inside PHP use the SUBSTR function
..inside the DB you could use the same named function SUBSTR
But understand that although the function are named the same and seemingly work the same one is a PHP fucntion (IE only works inside a PHP script, and the other is a MySQL function and only works inside a query
inside a query
select my, column, list, substr(mycolumn,1,20) as myshortenedcolumn from mytable
if message contains embedded HTML tags then you will need to close off those tags to display message properly
myvar = substr($row->message,1,20);
HTML_ENTITY_DECODE before running the substr that may also adjust the number of characters actually displayed
eg say you column message has '[b]this is emboldened text[ / b ]'
then running substr($row->message,1,20); woudl return '[b]this is emboldened te', but depending on the browser that was displayed that may dispaly as 'this is emboldened te' OR '[b]this is emboldened te' or soemthing else
I'd rather be riding on the Tiger 800 or the Norton