Jump to content

[SOLVED] Output Text Area Limit


phpbeginner

Recommended Posts

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.

Link to comment
Share on other sites

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]);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.