jesushax Posted July 10, 2008 Share Posted July 10, 2008 hi heres my little snippet if ((strlen($row["CompanyName"]) >25)) { $dot = '...';} echo substr($row["CompanyName"],0,25)."$dot</a></td>\n"; so if the lenght is longer thatn 25 cut it off and write a ... is whats supposed to be happening but its just putting $dot next to all the records :S Link to comment https://forums.phpfreaks.com/topic/114077-solved-strlen-gt25-problem/ Share on other sites More sharing options...
BillyBoB Posted July 10, 2008 Share Posted July 10, 2008 If you are in a while loop then try something like this. <?php while($blah = $blah) { $dot = ''; if(strlen($row["CompanyName"])>25) { $dot = '...';} echo substr($row["CompanyName"],0,25).$dot."</a></td>\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/114077-solved-strlen-gt25-problem/#findComment-586332 Share on other sites More sharing options...
jesushax Posted July 10, 2008 Author Share Posted July 10, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/114077-solved-strlen-gt25-problem/#findComment-586336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.