I should note that yes, i had previously read those, and for whatever reason my brain is doing a total freeze...but here is the code i am using... I can't seem to adapt the counting and such, maybe its no longer working??
<?php
require("system/config.php");
mysql_connect($connect,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$id = $HTTP_GET_VARS['id'];
$lastnum = $HTTP_GET_VARS['id'];
if($id == null)
{
$query = "SELECT id,title,author,date,time,full FROM news ORDER BY id DESC LIMIT 1";
$result=mysql_query($query);
$num=mysql_numrows($result);
}
else
{
$query = "SELECT id,title,author,date,time,full FROM news WHERE id='$lastnum'";
$result=mysql_query($query);
$num=mysql_numrows($result);
}
mysql_close();
$i=0;
while ($i < $num) {
$id=mysql_result($result, $i, "id");
$date=mysql_result($result, $i, "date");
$time=mysql_result($result, $i, "time");
$author=mysql_result($result, $i, "author");
$title=mysql_result($result, $i, "title");
$full=mysql_result($result, $i, "full");
echo "<center><table width=60%><tr>";
echo "<td><font color=#000000>$title</font></td></tr><tr>";
echo "<td><font size=1 color=#000000>Posted $date At $time, By $author</font></td></tr><tr>";
echo "<td><font color=#000000>$full</font></td></tr>";
echo "</table></center><br>";
++$i;
$lastnum;
$lastnum = $id - 1;
}
if ($lastnum == 0)
{
echo "<center><a href=news2.php>Latest News</a></center>";
}
else
{
echo "<center>";
echo "<a href=news2.php?id=$lastnum>Next Page</a>";
echo "</center>";
}
?>
I can display next page, next page, when someone just clicks on the news2.php without the id, but i would think that for the null id, i'd just display all news limit by whatever, which isnt a problem, easily doable...just kinda split into functions in a way. I still can't seem to adapt the pagination though, so if anyone could help me out there, i'd really appreciate it! I'm really trying to get the hang of pagination 🙂 I can do most anything else, but pagination seems to escape me! Weird!