You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.3 KiB
99 lines
2.3 KiB
<html>
|
|
<head>
|
|
<title>Olivebranch MS</title>
|
|
</head>
|
|
<body>
|
|
<form method="post" action="listall.php3">
|
|
<?
|
|
$lines_per_page = 15;
|
|
|
|
// connect to the database
|
|
$connection = pg_connect("localhost", "5432", "olivebranch");
|
|
|
|
$query = "SELECT * FROM member";
|
|
$result = pg_exec($connection, $query);
|
|
|
|
$total_rows = pg_numrows($result);
|
|
switch($bsact)
|
|
{
|
|
case "First Page":
|
|
$begin = 0;
|
|
break;
|
|
case "Previous Page":
|
|
$begin -= $lines_per_page;
|
|
if($begin < 0) $begin = 0;
|
|
break;
|
|
case "Next Page":
|
|
$begin += $lines_per_page;
|
|
if($begin > ($total_rows - $lines_per_page)) $begin = $total_rows - $lines_per_page;
|
|
break;
|
|
case "Last Page":
|
|
$begin = $total_rows - $lines_per_page;
|
|
break;
|
|
default:
|
|
$begin = 0;
|
|
break;
|
|
}
|
|
|
|
print("<TABLE border=1>\n");
|
|
|
|
$last_row = $begin + $lines_per_page;
|
|
if($last_row > $total_rows) $last_row = $total_rows;
|
|
|
|
print("<input type=\"hidden\" name=\"begin\" value=\"" . $begin . "\">");
|
|
|
|
for($row = $begin; $row < $last_row; $row++)
|
|
{
|
|
print("<TR>\n");
|
|
print("<td>$row</td>");
|
|
for($field = 0; $field < pg_numfields($result); $field++)
|
|
{
|
|
print("<td>");
|
|
if(pg_fieldisnull($result, $row, $field))
|
|
{
|
|
$price = "NULL";
|
|
}
|
|
else
|
|
{
|
|
print(pg_result($result, $row, $field));
|
|
}
|
|
print("</td>\n");
|
|
}
|
|
print("</TR>\n");
|
|
}
|
|
|
|
print("</TABLE>");
|
|
|
|
// close connection to the database
|
|
pg_freeresult($result);
|
|
pg_close($connection);
|
|
|
|
$total_pages = ($total_rows / $lines_per_page) + 1;
|
|
settype($total_pages, "integer");
|
|
if($begin == ($total_rows - $lines_per_page)) $page = $total_pages;
|
|
else
|
|
{
|
|
$page = ($begin / $lines_per_page) + 1.99;
|
|
settype($page, "integer");
|
|
}
|
|
|
|
print("<br>Page $page of $total_pages<br>\n");
|
|
|
|
if($total_rows > $lines_per_page)
|
|
{
|
|
if($begin > 0)
|
|
{
|
|
print("<input type=\"submit\" name=\"bsact\" value=\"First Page\">");
|
|
print("<input type=\"submit\" name=\"bsact\" value=\"Previous Page\">");
|
|
}
|
|
|
|
if($begin != ($total_rows - $lines_per_page))
|
|
{
|
|
print("<input type=\"submit\" name=\"bsact\" value=\"Next Page\">");
|
|
print("<input type=\"submit\" name=\"bsact\" value=\"Last Page\">");
|
|
}
|
|
}
|
|
?>
|
|
</form>
|
|
</body>
|
|
</html>
|