Limit Character Length
Posted: Thu Mar 31, 2005 1:39 pm
My script displays a chunk of text, but I want to limit the number of characters displayed (say, to 250).
How would i limit the number of characters displayed?
Code: Select all
<?php
mysql_select_db($database_db, $db);
$query_blogs = "SELECT * FROM blogs ORDER BY blogid DESC LIMIT 0,". $blogs_to_show ."";
$blogs = mysql_query($query_blogs, $db) or die(mysql_error());
$row_blogs = mysql_fetch_assoc($blogs);
$totalRows_blogs = mysql_num_rows($blogs);
?>
<?php include("header.php"); ?>
<body>
<?php include("header2.php"); ?>
<br>
<table width="750" border="0" cellspacing="3" cellpadding="0">
<tr valign="top">
<td width="545">
<?php if ($totalRows_blogs >= 1) { ?>
<?php do { ?>
<table width="545" border="0" cellspacing="0" cellpadding="1">
<tr>
<td><a href="<?php echo $website_url; ?>/blog_articles.php?blogid=<?php echo $row_blogs['blogid']; ?>" class="blog_title"><?php echo stripslashes($row_blogs['title']); ?></a></td>