showing a limited number of characters in a string.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

showing a limited number of characters in a string.

Post by mattyboi »

I have a field in a database that allows a lot of characters. I would only like to show the first 20 characters or so when I display it on the webpage.

Any ideas?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Probably your dbms has builtint functions for strings... Usually it's called SUBSTRING or SUBSTR... And php has one too (as a last resort).
Post Reply