Hello all,
Currently I am querying a database to show recent news that has been added to a MySQL DB but I only want it to display up to a certain number of characters. ie: if the story is 1000 characters only to show up to 150 characters. After this there is a link for 'more information'. I am not having problems with the query or the dynamic linking but rather I have having problems with limiting the OUTPUT to a certain number of characters. the code I am using is pasted below, please help:
<?php
$limit=3; // rows to return
$numresults = tep_db_query ("select * from modules order by date_posted DESC");
$numrows = tep_db_num_rows($numresults);
// next determine if offset has been passed to script, if not use 0
if (empty($offset))
{
$offset=0;
}
// get results
$result = tep_db_query ("select * from modules order by date_posted DESC limit $offset, $limit");
// Set $begin and $end to record range of the current page
$begin =($offset+1);
$end = ($begin+($limit-1));
if ($end > $totalrows)
{
$end = $totalrows;
}
// Display result information.
$query = "SELECT * from modules order by date_posted DESC limit $offset, $limit";
$result = tep_db_query($query);
while($row = mysql_fetch_row($result))
{
$article_id=$row[0];
$date_posted=$row[1];
$headline=$row[2];
$content=$row[3];
$image=$row[4];
$align=$row[5];
echo "<table width=100% border=0 cellspacing=0 cellpadding=3><tr><td width=97% valign=top height=29 align=left>";
echo "<img src=$image align=$align hspace=3 vspace=1><b><font color=#990000 size=3 face=Arial, Helvetica, sans-serif><a href=article.php?article_id=$article_id>$headline</a></font></b><br><font size=1 face=Arial, Helvetica, sans-serif>$date_posted</font><br><font size=2 face=Arial, Helvetica, sans-serif>$content</font>";
echo "</td></tr><tr align=center><td width=97% valign=top height=2><img src=images/dots350.png width=350 height=18></td></tr></table>";
}
?>