|
Posted by baccaril on 11/22/06 15:37
Yes I have links printed at the end of the first page for viewing
additional rows/page.
I did not believe I need to pass the vaiable. If needed how do I do
that?
Lou
Here is the code for links at end og page.
============================================================
#
# print number of pages available at bottom of the web page
// how many rows we have in database
$query = "SELECT COUNT(*) AS numrows FROM $dbname";
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page "; // no need to create a link to current page
}
else
{
$nav .= " <a href=\"$self?page=$page\">$page</a> ";
}
}
print "$nav";
=====================================================
baccaril@gmail.com wrote:
> Hello,
>
> I have a form the post to a php script, the variable is passed to the
> php script successfully. I then query MySQL and output 8 rows at a
> time. So the problem I'm having is the first 8 rows are displayed on
> the web page correctly, but now when I attempt to display rows 9-16
> the variable that was posted from the form is now blank. How do I
> ensure the variable does not disappear?
>
> LouB.
>
> =================================
> Here are the three main part of my php script.
>
>
> # post from form....
> $sortby = $_REQUEST["sortby"];
>
> $query = "select personal_identifier, first_name, last_name,
> company_name, photo_path, custom_field_1 from $dbname order by $sortby
> limit $offset, $rowsPerPage";
>
> result = mysql_query ($query)
> //or die ("Cannot execute query");
> or die (mysql_error());
Navigation:
[Reply to this message]
|