ded Posted July 26, 2008 Share Posted July 26, 2008 Good Morning, I gave ability to a person to upload a news article to the database. I want the first 50 characters (for example) to show on the home page with a "MORE" link that would expand to the full article. Question is, how do I limit the home page to the first 50 character of the database field? It is possible or do I have to create a second field that the user will populate with what they want on the home page? I hope this was clear. Regards, DED Quote Link to comment https://forums.phpfreaks.com/topic/116712-first-50-characters-of-database-field/ Share on other sites More sharing options...
ratcateme Posted July 26, 2008 Share Posted July 26, 2008 just get the whole field then use substr($news,0,50) to cut it down to 50 characters Scott. Quote Link to comment https://forums.phpfreaks.com/topic/116712-first-50-characters-of-database-field/#findComment-600091 Share on other sites More sharing options...
ignace Posted July 26, 2008 Share Posted July 26, 2008 SELECT substr('field', 0, 50) intro FROM table All string related mysql functions can be found here: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/116712-first-50-characters-of-database-field/#findComment-600092 Share on other sites More sharing options...
ded Posted July 26, 2008 Author Share Posted July 26, 2008 Duh.....I guess I should have known that. Did not think it was that simple. Thank you both Quote Link to comment https://forums.phpfreaks.com/topic/116712-first-50-characters-of-database-field/#findComment-600093 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.