monkeytooth Posted May 12, 2008 Share Posted May 12, 2008 Alright I have this database for a friend, which is a simple blog/journal type thing, where on the main page it pulls from the DB and seperates each entry into a block. Which works fine for the most part, however what I want to do is truncate the message body down a bit per entry, as this kid can be long winded at times. Right now the way its set up is that when the main page loads and all the blocks get displayed they show everything... I just want to break the main message body down to 100 charicters/words or less then put a read more link, where the full size can be viewed from there.. Which all that I can do fine its just getting the message to break down on the front page thats posing tricky for me at the moment. Mind you theres already a handful of messages so if its possible to just go based on existing that would be great. any ideas suggestions help? Link to comment https://forums.phpfreaks.com/topic/105326-solved-truncated-text-query/ Share on other sites More sharing options...
soycharliente Posted May 12, 2008 Share Posted May 12, 2008 http://us.php.net/substr Link to comment https://forums.phpfreaks.com/topic/105326-solved-truncated-text-query/#findComment-539404 Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 $short = substr($row['text'], 0, 100) . "..."; //Will output first 100 characters + ... Please put in your own SQL row. =P Link to comment https://forums.phpfreaks.com/topic/105326-solved-truncated-text-query/#findComment-539408 Share on other sites More sharing options...
monkeytooth Posted May 12, 2008 Author Share Posted May 12, 2008 Exelent, thanks to both of you.. Read through the manual with the link above that helped lovely, and dark that might even work better.. Thanks Link to comment https://forums.phpfreaks.com/topic/105326-solved-truncated-text-query/#findComment-539425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.