I have a search page that gets images from a database and contains 140 images. The problem comes when a particular term is searched for and a result- say of 10 images- returned. The first page displays fine, but when the link for the next page is used, it defaults back to all 140 images, instead of showing the next set of results. I am very new to this and am trying to resolve this - I hope I have put all of the relevant code. I wonder if anyone can point me in the right direction.
<td nowrap>Images <b><?php echo ($startRow_imgs) ?></b> to <b><?php echo ($startRow_imgs + $totalRows_imgs) ?></b>
returned out of <strong><?php echo $allRows_imgs ?></strong> total.</td>
</tr>
<tr>
<td> </td>
<td align="right"> <table border="0">
<tr>
<td align="center"> <?php if ($pageNum_imgs > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, 0, $queryString_imgs); ?>">First</a>
|
<?php } // Show if not first page ?> </td>
<td align="center"> <?php if ($pageNum_imgs > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, max(0, $pageNum_imgs - 1), $queryString_imgs); ?>">Previous</a>
|
<?php } // Show if not first page ?> </td>
<td align="center"> <?php if ($pageNum_imgs < $totalPages_imgs) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, min($totalPages_imgs, $pageNum_imgs + 1), $queryString_imgs); ?>">Next</a>
|
<?php } // Show if not last page ?> </td>
<td align="center"> <?php if ($pageNum_imgs < $totalPages_imgs) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, $totalPages_imgs, $queryString_imgs); ?>">Last</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<td nowrap>Images <b><?php echo ($startRow_imgs) ?></b> to <b><?php echo ($startRow_imgs + $totalRows_imgs) ?></b>
returned out of <strong><?php echo $allRows_imgs ?></strong> total.</td>
</tr>
<tr>
<td> </td>
<td align="right"> <table border="0">
<tr>
<td align="center"> <?php if ($pageNum_imgs > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, 0, $queryString_imgs); ?>">First</a>
|
<?php } // Show if not first page ?> </td>
<td align="center"> <?php if ($pageNum_imgs > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, max(0, $pageNum_imgs - 1), $queryString_imgs); ?>">Previous</a>
|
<?php } // Show if not first page ?> </td>
<td align="center"> <?php if ($pageNum_imgs < $totalPages_imgs) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, min($totalPages_imgs, $pageNum_imgs + 1), $queryString_imgs); ?>">Next</a>
|
<?php } // Show if not last page ?> </td>
<td align="center"> <?php if ($pageNum_imgs < $totalPages_imgs) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_imgs=%d%s", $currentPage, $totalPages_imgs, $queryString_imgs); ?>">Last</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>