pantinosm Posted November 21, 2006 Share Posted November 21, 2006 Hi everyone. I am new to php so i be patient. I have a mysql db and i use a recordset to manipulate it.I have a table in html and i try to fill it with data. The problem is that a field is a url link with no spaces that causes my page to break.So i need somehow to show only the start of the link and then ... like yahoo lets say.My problem can be seen here [url=http://www.ibeba.com/world/worldsearch.php?txtsearch=art&Submit=Search+Her]http://www.ibeba.com/world/worldsearch.php?txtsearch=art&Submit=Search+Her[/url]Thank you in advance. Link to comment https://forums.phpfreaks.com/topic/27998-how-to-have-a-limit-for-character-viwing-in-a-recordset/ Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 [code]$text= "reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally long word";wordwrap($text, 20, "<br />\n");[/code] Link to comment https://forums.phpfreaks.com/topic/27998-how-to-have-a-limit-for-character-viwing-in-a-recordset/#findComment-128073 Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 i also wrote this pretty little function[code]<?function filter_charlimit($string, $length="50"){ if(strlen($string)<$length) return $string; else return trim(substr($string, 0, $length)).'...';}?>[/code] Link to comment https://forums.phpfreaks.com/topic/27998-how-to-have-a-limit-for-character-viwing-in-a-recordset/#findComment-128074 Share on other sites More sharing options...
pantinosm Posted November 21, 2006 Author Share Posted November 21, 2006 Thank you so much. That works great. Link to comment https://forums.phpfreaks.com/topic/27998-how-to-have-a-limit-for-character-viwing-in-a-recordset/#findComment-128100 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.