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
https://forums.phpfreaks.com/topic/156602-a-way-of-limiting-the-amount-of-text/
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']; ?>

 

 

 

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.