If I have a paragraph stored in a mySQL database can I just have it show so many lines of it in the output for example: DATABASE RECORD: This is an article about showing only part of a mysql database record. I hope this helps more than just me. Thank you for all of your help and I hope it works because this would be a great help to a website I am working on. DISPLAY ONLY: This is an article about showing only part of a mysql databaserecord, I hope this helps more than just .... Then I will have a link to read more. Thank you in advance
Here's a truncate function that I use for purposes like this: function truncate($data, $length = 150) { $data = strip_tags($data); return substr($data,0,$length.'...'); } PHP: You could modify this to include a link instead of ... You can also do this on a database level. SELECT LEFT(text_field,150) AS truncated_text FROM my_table; Or even something like: SELECT CONCAT( '<p>', LEFT(text_field,150), ' <a href="link_to_page.php?id=', page_id, '"> Continue reading...</a></p>') AS formatted_string FROM my_table;
Aparently you have helped me quite a bit +rep although it won't let me it says I must spread around first. Thank you