Hello everybody.. I've been trying to put together a simple news script. This is what I have in my index.php.
I'm having trouble with the Pages: part of the script.
It shows me how many pages are in total (ex: Pages: 1 2) however when I click on 2, it doesn't take me to the other 5 posts.
Can somebody debug it for me?
I would really appreciate your help. Thanx. Here's the code:
Code:
<? echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
$query = mysql_query("SELECT Id, date, title, post FROM news ORDER BY Id desc LIMIT 5") or die(mysql_error());
$newsnum = 0;
while($var = mysql_fetch_array($query)) {
$Id = $var['Id'];
$date = $var['date'];
$title = $var['title'];
$post = $var['post'];
$newsnum++;
echo "<tr><td align='center'><table width='100%' border='0' cellpadding='1' cellspacing='2' class='newstop'>
<tr>
<td><span class='font-orange'><b>$date</b></font><span class='font-white2'> | <b>$title</b></span></td>
</tr>
</table>
<table width='100%' height='42' border='0' cellpadding='0' cellspacing='2' class='newsnews'>
<tr>
<td height='38' valign='top'><span class='font-white'>$post</font><br> <table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='12'></td>
</tr>
</table></td>
</tr>
</table>
</td></tr><tr><td height='5'></td></tr>";
}
echo "</table>";
$ttnum =1;
$totnum = $newsnum / 5 + 1;
echo "<span class='font-orange'>Pages:</span> ";
while ($ttnum <= $totnum){
echo "<b><a href=\"index.php?id=$newsnum&faqe=$ttnum\"><span class='font-white2'>$ttnum</span></a></b>";
$ttnum ++;}
?>