Jump to content

a way of limiting the amount of text


dachshund

Recommended Posts

hi

 

sorry if this doesn't make much sense, but it's quite hard to describe.

 

is there a way of limiting the amount of text that your php code can input into a table?

 

for example if in the mysql table field there is 150 characters of text, but i only want it to recall a maximum of 80 characters.

 

is there a way of doing this?

 

hope that makes sense, it's quite late and i'm pretty tired.

Link to comment
Share on other sites

hmm can't get it to work

 

here's parts of my code.

 

<?php
$today = date('Y-m-d');
$sql="SELECT * FROM features ORDER BY id DESC";
$result=mysql_query($sql);
$str = 'something...';
$len = 80;
if (($str_len = strlen($str)) < $len) $len = $str_len;
$str = substr($str, 0, $len);
?>

 

and this is the echo i want to limit

 


<? echo $rows['condensedcontent']; ?>

 

 

 

Link to comment
Share on other sites

  • 1 month later...
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.