Jump to content

Limiting text output from DB


sotusotusotu

Recommended Posts

Hey,

 

I have developed a simple from system that allows users to input some comments. This all works fine, however when I try to retrieve the comments I only want to display 100 characters.

 

I am new to PHP, but was wondering if there is a string function that will let me take the data from a table in my database and then only display 100 characters followed by "..." afterwards.

 

Also I have thought of a potential problem... if someone enters less than 100 characters I only want to show the amount they have entered.

 

can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/62325-limiting-text-output-from-db/
Share on other sites

also, you should do some kind of checking loop that checks if the last character is a blank space or not and continues to chop off the last letter until it encounters a blank space, cuz it looks ugly to have these 100 character summaries cut off in the middle of a word, like this for examp....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.