i have a mysql database and a table full of information, specifically a column of product descriptions. This column is used in my scripts twice. Its max length is 1000 characters.
One of the uses for this information is a brief description of any given product. I would like to display a shortened version of the description that I have just mentioned, so it will be say for instance 200 characters long.
Now, using PHP I would like to append the string with “…” (3 dots) at the point where it reaches 200 characters. So basically only the first 200 characters are displayed.
How would I go about something like this? I am sure it will be a fairly simple task but the internet is a big place to look for something you don’t know the name of 🙂
If anyone could help in this regard, with an example or some links relating to the relevant functions that would be great. Thanks a lot!
Only collect 200 characters from your database in the first place.
Then apply something like this, but essentially you need to go back to the previous word end chop off the rest and apend an elipsis.