Character display

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
thoughtriot
Forum Commoner
Posts: 26
Joined: Thu Nov 07, 2002 9:32 pm

Character display

Post by thoughtriot »

I have a test field called Entry for a news table, and I was wondering how I could put a little "preview" of the latest entry on a page where only x amount of letters/characters are displayed, then I'll just put a "Read more >" link or something. But how would I only display 50 or so characters, please?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You'd want to either limit how much of the string you either selected or output. Take a look at:
LEFT(): http://www.mysql.com/doc/en/String_func ... ml#IDX1175
or for a PHP version:
substr(): http://www.php.net/substr

Mac
Post Reply