I think I am getting really close here, thanks for the input I combined it in with what I had. Now I get the links generated correctly But.... mabey i am doing something wrong with the start variable because the 1 2 3 4 5 6 7 8 9 10 links dont carry me anywhere unforutunatly. Ill keep craking at it, sooner or later it should work!
Code:
<?php
if(!isset($start)) $start = 0;
$connect = mysql_connect("$dbhost", "$dbuser", "$dbpass");
mysql_select_db($dbname);
$query = "SELECT * FROM classified LIMIT " . $start . ", 10";
// Find totals
$query2 = "SELECT * FROM classified";
$result2 = mysql_query($query2);
$rowcount2 = mysql_num_rows($result2);
$result = mysql_query($query);
$rowcount = mysql_num_rows($result);
if ($rowcount >= 1)
{
$ender = $start + 10;
$begin = $start + 1;
include ("adhead.php");
if ($ender >= $begin)
{
print "<h5>Viewing $begin - $rowcount2 of $rowcount2 Results</center></h5>";
}
else
{
print "<h5>Viewing $begin - $ender of $rowcount2 Results</center></h5>";
}
print "<table border=0 width=135% cellspacing=0 cellpadding=0>";
print "<TR>";
$colorshift = white;
$track = 0;
while ($row = mysql_fetch_array ($result))
{
print "<table border=0 width=135% cellspacing=0 cellpadding=0>";
print "<TR>";
if ($colorshift == white)
{
$color = ffffff;
$colorshift = gray;
}
else
{
$colorshift = white;
$color = eeeeee;
}
print "<td width=20% bgcolor=#$color>";
print "<img src=public/images/$row[picture].jpg width=75 height=75>";
print "</td>";
print "<td width=20% bgcolor=#$color>";
print "<p align=center><font size=2 color=#0000FF><b><a href=$row[id].html><font
color=#0000ff>$row[name]</b></font></p>";
print "</td>";
print "<td width=20% bgcolor=#$color>";
print "<p align=center><font size=2 color=#0000FF><b>$row[catagory]</b></font></p>";
print "</td>";
print "<td width=20% bgcolor=#$color>";
print "<p align=center><font size=2 color=#0000FF><b>$row[price]</b></font></p>";
print "</td>";
print "<td width=20% bgcolor=#$color>";
print "<p align=center><font size=2 color=#0000FF><b>$row[date]</b></font></p>";
print "</td>";
print "</tr>";
print "</table>";
$track++;
}
print "<TABLE BORDER=0 WIDTH=135%>";
print "<TR>";
print "<TD ROWSPAN=2 WIDTH=200>";
print "</TD>";
print "<TD>";
print "</TD>";
print "</TR>";
print "<TR><TD ALIGN=left>";
print "<br>";
print "</A>";
print "</TABLE>";
if($lastpage >$totalpages)
{
$lastpage = $totalpages;
}
$lastpage = 10 + $start;
// Generate page links for 1 2 3 4 5 6 7 8 9 10
for($i = $start; $i <= $lastpage; $i++)
{
if($i == $start)
{
echo(" ".$i." ");
}
else
{
echo(" <center><font color=0000ff><b><a
href=\"$PHP_SELF?page=$i&$start=$start+10\">$i</font></b></a></center> ");
}
}
print "<br><Br>";
$query = "SELECT count(*) as count FROM classified";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$numrows = $row['count'];
if($start > 0)
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 10) .
"\"><center><font color=0000ff><b><< Previous</b></font></a>\n";
if($numrows > ($start + 10))
echo " <b>|</b> ";
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 10) .
"\"><font color=0000ff><b>Next >></b></a><BR>\n";
}
else
{
include ("adhead.php");
print "<TABLE BORDER=0 WIDTH=400>";
print "<TR>";
print "<TD ROWSPAN=2 WIDTH=100>";
print "</TD>";
print "<TD>";
print "</TD>";
print "</TR>";
print "<TR><TD ALIGN=center>";
print "<h3>No records matching your information were found<h3>";
print "</A>";
print "</TABLE>";
}
include("footer.php");
mysql_free_result ($result);
?>