phpbeginner Posted June 26, 2007 Share Posted June 26, 2007 I have read this somewhere but can't find it and I know it's simple for most of you but how do I output a specific number of characters from blob. I have a frontpage block which will be linking to the full blob, but I only want to have maybe 90 or so characters from the blob in my frontpage block. Quote Link to comment Share on other sites More sharing options...
trq Posted June 26, 2007 Share Posted June 26, 2007 substr(). Quote Link to comment Share on other sites More sharing options...
marcus Posted June 26, 2007 Share Posted June 26, 2007 You can use substr <?php //say you have a sql query already and $row = mysql_fetch_assoc($res) $body = substr($row[body],0,90); //the 1st character to the 90th character echo $body; //to find character length of the blob use: echo strlen($row[body]); ?> Quote Link to comment Share on other sites More sharing options...
phpbeginner Posted June 26, 2007 Author Share Posted June 26, 2007 Yep, too easy. Thanks a bunch ! Quote Link to comment 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.