You are here: Re: Lmit Characters « PHP Programming Language « IT news, forums, messages
Re: Lmit Characters

Posted by petersprc on 02/25/07 22:12

Hi,

substr(strip_tags($text), 0, 50)

On Feb 25, 5:02 pm, "zek2005" <esapoznik@gmail.com> wrote:
> Hi!
>
> I have a MySQL DB with a text field that includes both text and HTML
> tags. When I invoke that field in a page, I only see the text (not the
> HTML tags, of course). I only want to chow the first 50 characters of
> that field, but If use the substr function the result shows my the
> HTML tags, because the HTML tags could be in the middle of the substr
> limit, I mean:
>
> $text=This is a <B>test</B> that I want to show
>
> If I use a substr ($text, 18), I receive:
>
> "This is a <B>test<"
>
> I need to avoid the HTML tags and show only the text. I need only to
> receive:
>
> "This is a test tha" --> 18 characters
>
> So...I need only the substring of the result of the field already
> formated
>
> Any suggestions?
>
> Thanks!
>
> Ezequiel

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация