Hi ,
I am have some trouble with my next & Previous button in this page.
The page displays the first 10 results in a table a next button but on click it just loads the same page again.
Any ideas ????
<?PHP
if(!isset($start)) $start = 0;
$db = mysql_connect("localhost", "user", "password")
or die ("cant connect to the DB");
print ("You have connected to database successfully");
?><html><br><br><?php
mysql_select_db("test",$db);
$query = "SELECT * FROM employees LIMIT " . $start . ", 10";
//do database connection
$result = mysql_query($query);
//display data
echo "<table border=1>\n";
echo "<tr><td>Name</td><td>e-mail</td><td>Department</td><td>Photo</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td><td>%s</td><td>
%s</td>\n",
$myrow[1], $myrow[2],$myrow[3], $myrow[4], $myrow[5]);
}
echo "</table>\n";
// Total amount of rows in our table
$query = "SELECT count(*) as count FROM employees";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$numrows = $row['count'];
if($start > 0)
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 10) .
"\">Previous</a><BR>\n";
if($numrows > ($start + 10))
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 10) .
"\">Next</a><BR>\n";
?>