Forums
This topic is locked
Next and previous page behaviour
Posted 19 Oct 2004 19:52:30
1
has voted
19 Oct 2004 19:52:30 john henderson posted:
I cant see for the life of me what I am doing wrong with the page behaviours. dw seems to ignore the fact that there are more pages available, instead it is going of and displaying evry thing. For example my database has 12 records for the country of wales. If I display them as 6 at a time using the repeat region, when I select next page it displays other countries on the next page. Should I be using repeat region with page behaviours. I dont know, it is a simple request can some one advise me please.thanks john
THanks for your assistance, may be one day I'll be able to help you.
Replies
Replied 21 Oct 2004 10:54:01
21 Oct 2004 10:54:01 Vince Baker replied:
Hi John,
Can you post the code from your page here so I can take a look?
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)
VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
Can you post the code from your page here so I can take a look?
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)
VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
Replied 21 Oct 2004 14:11:26
21 Oct 2004 14:11:26 john henderson replied:
Hi Vince,
Thanks for responding. As I said I cant figure out what is going on with the page behaviours. As you requested here is the code for that page. Everything else works fine. As a guess could it be something to do with the way the post or get variables are set up. Looking forward to your reply.
john
<?php require_once('Connections/ConnESGolf.php'); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
$maxRows_rsClubsearch = 20;
$pageNum_rsClubsearch = 0;
if (isset($HTTP_GET_VARS['pageNum_rsClubsearch'])) {
$pageNum_rsClubsearch = $HTTP_GET_VARS['pageNum_rsClubsearch'];
}
$startRow_rsClubsearch = $pageNum_rsClubsearch * $maxRows_rsClubsearch;
$categorylist_rsClubsearch = "1";
if (isset($HTTP_POST_VARS['categorylist'])) {
$categorylist_rsClubsearch = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['categorylist'] : addslashes($HTTP_POST_VARS['categorylist']);
}
$searchfield_rsClubsearch = "1";
if (isset($HTTP_POST_VARS['searchfield'])) {
$searchfield_rsClubsearch = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['searchfield'] : addslashes($HTTP_POST_VARS['searchfield']);
}
mysql_select_db($database_ConnESGolf, $ConnESGolf);
$query_rsClubsearch = sprintf("SELECT * FROM golfclubs WHERE %s LIKE '%%%s%%' ORDER BY Golfclubname ASC", $categorylist_rsClubsearch,$searchfield_rsClubsearch);
$query_limit_rsClubsearch = sprintf("%s LIMIT %d, %d", $query_rsClubsearch, $startRow_rsClubsearch, $maxRows_rsClubsearch);
$rsClubsearch = mysql_query($query_limit_rsClubsearch, $ConnESGolf) or die(mysql_error());
$row_rsClubsearch = mysql_fetch_assoc($rsClubsearch);
if (isset($HTTP_GET_VARS['totalRows_rsClubsearch'])) {
$totalRows_rsClubsearch = $HTTP_GET_VARS['totalRows_rsClubsearch'];
} else {
$all_rsClubsearch = mysql_query($query_rsClubsearch);
$totalRows_rsClubsearch = mysql_num_rows($all_rsClubsearch);
}
$totalPages_rsClubsearch = ceil($totalRows_rsClubsearch/$maxRows_rsClubsearch)-1;
$queryString_rsClubsearch = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsClubsearch"
== false &&
stristr($param, "totalRows_rsClubsearch"
== false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsClubsearch = "&" . implode("&", $newParams);
}
}
$queryString_rsClubsearch = sprintf("&totalRows_rsClubsearch=%d%s", $totalRows_rsClubsearch, $queryString_rsClubsearch);
$queryString_rsClubsearch = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsClubsearch"
== false &&
stristr($param, "totalRows_rsClubsearch"
== false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsClubsearch = "&" . implode("&", $newParams);
}
}
$queryString_rsClubsearch = sprintf("&totalRows_rsClubsearch=%d%s", $totalRows_rsClubsearch, $queryString_rsClubsearch);
?>
<html>
<head>
<title>Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
color: #404142;
font-family: tahoma;
font-size: 11px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #313131;
}
form{ margin:0px;
padding:0px;
}
a:link {
color: #0000FF;
}
a:visited {
color: #0000FF;
}
a:hover {
color: #0000FF;
}
a:active {
color: #0000FF;
}
.style1 {
color: #FFFFFF;
font-weight: bold;
}
.style2 {color: #242424}
.style3 {color: #FFFFFF}
.style4 {
color: #E2E2E2;
font-weight: bold;
}
.style5 {font-size: 10px}
.lim{
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
}
.lim2{
margin-left: 10px;
margin-top: 8px;
margin-right: 10px;
}
.style10 {
color: #AEADAD;
font-size: 9px;
}
.style13 {
color: #00498F;
font-weight: bold;
}
-->
</style></head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td height="11%" > </td>
<td></td>
</tr>
<tr valign="top">
<td width="30%" height="32" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="86"></td>
</tr>
<tr>
<td height="469" background="images/right.jpg" style="background-repeat:repeat-x "></td>
</tr>
</table></td>
<td width="38%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/upbeforehome.jpg" width="678" height="31"></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/homesize.jpg" width="102" height="1"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" height="26" align="center"><a href="index.php"><img src="images/home.jpg" width="11" height="11" border="0"></a></td>
<td width="9%" align="center"><img src="images/between.jpg" width="4" height="21"></td>
<td width="21%" align="center"><a href="sitemap.php"><img src="images/map.jpg" width="13" height="11" border="0"></a></td>
<td width="9%" align="center"><img src="images/between.jpg" width="4" height="21"></td>
<td width="41%" align="center"><a href="emailus.php"><img src="images/email.jpg" width="13" height="8" border="0"></a> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="26%" align="right" valign="top"><img src="images/logo.png" width="207" height="44"></td>
<td width="74%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="131"><object classid="clsid
27CDB6E-AE6D-11cf-96B8-444553540000" codebase="download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="559" height="34">
<param name="movie" value="flash/menu.swf">
<param name="quality" value="high">
<embed src="flash/menu.swf" quality="high" pluginspage="www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="559" height="34"></embed>
</object></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="11" valign="top"><img src="images/down.jpg" width="780" height="11"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1%" height="464" valign="top"><img src="images/lefta.jpg" width="15" height="464"></td>
<td width="98%" valign="top" bgcolor="#FFFFFF"><table width="85%" height="70" border="0" align="center">
<caption>
<font size="1"><?php echo $totalRows_rsClubsearch ?></font> <a href="<?php printf("%s?pageNum_rsClubsearch=%d%s", $currentPage, min($totalPages_rsClubsearch, $pageNum_rsClubsearch + 1), $queryString_rsClubsearch); ?>">Next</a>
</caption>
<tr bgcolor="#999999">
<td height="20"><strong><font color="#FFFFFF">club</font></strong></td>
<td><strong><font color="#FFFFFF">town</font></strong></td>
<td><strong><font color="#FFFFFF">county</font></strong></td>
<td><font color="#FFFFFF">Country</font></td>
</tr>
<?php do { ?>
<tr>
<td height="21"><?php echo $row_rsClubsearch['Golfclubname']; ?></td>
<td><?php echo $row_rsClubsearch['town']; ?></td>
<td><?php echo $row_rsClubsearch['county']; ?></td>
<td><?php echo $row_rsClubsearch['Country']; ?></td>
</tr>
<tr>
<td height="21" colspan="4"><?php echo $row_rsClubsearch['details']; ?></td>
</tr>
<?php } while ($row_rsClubsearch = mysql_fetch_assoc($rsClubsearch)); ?>
</table>
<p> </p>
<?php if ($totalRows_rsClubsearch == 0) { // Show if recordset empty ?>
<p align="center"><strong><font color="#FF0000" size="3">Sorry but
no records were found please try again</font></strong></p>
<p align="center"><strong><font color="#000000" size="3"><a href="clubsearch6.php">Search</a></font></strong></p>
<?php } // Show if recordset empty ?></td>
<td width="1%" valign="top"><img src="images/right.jpg" width="14" height="458"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2%" height="30"> </td>
<td width="97%" align="center" background="images/dwnover.jpg" style="background-repeat:no-repeat "><a href="privacy.php"><font color="#FFFFFF">Privacy
Statement </font></a> <img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u3.jpg" width="105" height="6" border="0"></a><img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u4.jpg" width="115" height="7" border="0"></a><img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u5.jpg" width="54" height="6" border="0"></a><img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u6.jpg" width="72" height="6" border="0"></a><img src="images/u2.jpg" width="3" height="10"><font color="#FFFFFF">
<?php echo $row_rsSiteinfo['copyright']; ?></font></td>
<td width="1%"> </td>
</tr>
</table></td>
<td width="60%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="86"></td>
</tr>
<tr>
<td height="469" background="images/right.jpg" style="background-repeat:repeat-x "></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsClubsearch);
?>
THanks for your assistance, may be one day I'll be able to help you.
Thanks for responding. As I said I cant figure out what is going on with the page behaviours. As you requested here is the code for that page. Everything else works fine. As a guess could it be something to do with the way the post or get variables are set up. Looking forward to your reply.
john
<?php require_once('Connections/ConnESGolf.php'); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
$maxRows_rsClubsearch = 20;
$pageNum_rsClubsearch = 0;
if (isset($HTTP_GET_VARS['pageNum_rsClubsearch'])) {
$pageNum_rsClubsearch = $HTTP_GET_VARS['pageNum_rsClubsearch'];
}
$startRow_rsClubsearch = $pageNum_rsClubsearch * $maxRows_rsClubsearch;
$categorylist_rsClubsearch = "1";
if (isset($HTTP_POST_VARS['categorylist'])) {
$categorylist_rsClubsearch = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['categorylist'] : addslashes($HTTP_POST_VARS['categorylist']);
}
$searchfield_rsClubsearch = "1";
if (isset($HTTP_POST_VARS['searchfield'])) {
$searchfield_rsClubsearch = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['searchfield'] : addslashes($HTTP_POST_VARS['searchfield']);
}
mysql_select_db($database_ConnESGolf, $ConnESGolf);
$query_rsClubsearch = sprintf("SELECT * FROM golfclubs WHERE %s LIKE '%%%s%%' ORDER BY Golfclubname ASC", $categorylist_rsClubsearch,$searchfield_rsClubsearch);
$query_limit_rsClubsearch = sprintf("%s LIMIT %d, %d", $query_rsClubsearch, $startRow_rsClubsearch, $maxRows_rsClubsearch);
$rsClubsearch = mysql_query($query_limit_rsClubsearch, $ConnESGolf) or die(mysql_error());
$row_rsClubsearch = mysql_fetch_assoc($rsClubsearch);
if (isset($HTTP_GET_VARS['totalRows_rsClubsearch'])) {
$totalRows_rsClubsearch = $HTTP_GET_VARS['totalRows_rsClubsearch'];
} else {
$all_rsClubsearch = mysql_query($query_rsClubsearch);
$totalRows_rsClubsearch = mysql_num_rows($all_rsClubsearch);
}
$totalPages_rsClubsearch = ceil($totalRows_rsClubsearch/$maxRows_rsClubsearch)-1;
$queryString_rsClubsearch = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsClubsearch"

stristr($param, "totalRows_rsClubsearch"

array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsClubsearch = "&" . implode("&", $newParams);
}
}
$queryString_rsClubsearch = sprintf("&totalRows_rsClubsearch=%d%s", $totalRows_rsClubsearch, $queryString_rsClubsearch);
$queryString_rsClubsearch = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsClubsearch"

stristr($param, "totalRows_rsClubsearch"

array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsClubsearch = "&" . implode("&", $newParams);
}
}
$queryString_rsClubsearch = sprintf("&totalRows_rsClubsearch=%d%s", $totalRows_rsClubsearch, $queryString_rsClubsearch);
?>
<html>
<head>
<title>Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
color: #404142;
font-family: tahoma;
font-size: 11px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #313131;
}
form{ margin:0px;
padding:0px;
}
a:link {
color: #0000FF;
}
a:visited {
color: #0000FF;
}
a:hover {
color: #0000FF;
}
a:active {
color: #0000FF;
}
.style1 {
color: #FFFFFF;
font-weight: bold;
}
.style2 {color: #242424}
.style3 {color: #FFFFFF}
.style4 {
color: #E2E2E2;
font-weight: bold;
}
.style5 {font-size: 10px}
.lim{
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
}
.lim2{
margin-left: 10px;
margin-top: 8px;
margin-right: 10px;
}
.style10 {
color: #AEADAD;
font-size: 9px;
}
.style13 {
color: #00498F;
font-weight: bold;
}
-->
</style></head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td height="11%" > </td>
<td></td>
</tr>
<tr valign="top">
<td width="30%" height="32" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="86"></td>
</tr>
<tr>
<td height="469" background="images/right.jpg" style="background-repeat:repeat-x "></td>
</tr>
</table></td>
<td width="38%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/upbeforehome.jpg" width="678" height="31"></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/homesize.jpg" width="102" height="1"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" height="26" align="center"><a href="index.php"><img src="images/home.jpg" width="11" height="11" border="0"></a></td>
<td width="9%" align="center"><img src="images/between.jpg" width="4" height="21"></td>
<td width="21%" align="center"><a href="sitemap.php"><img src="images/map.jpg" width="13" height="11" border="0"></a></td>
<td width="9%" align="center"><img src="images/between.jpg" width="4" height="21"></td>
<td width="41%" align="center"><a href="emailus.php"><img src="images/email.jpg" width="13" height="8" border="0"></a> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="26%" align="right" valign="top"><img src="images/logo.png" width="207" height="44"></td>
<td width="74%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="131"><object classid="clsid

<param name="movie" value="flash/menu.swf">
<param name="quality" value="high">
<embed src="flash/menu.swf" quality="high" pluginspage="www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="559" height="34"></embed>
</object></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="11" valign="top"><img src="images/down.jpg" width="780" height="11"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1%" height="464" valign="top"><img src="images/lefta.jpg" width="15" height="464"></td>
<td width="98%" valign="top" bgcolor="#FFFFFF"><table width="85%" height="70" border="0" align="center">
<caption>
<font size="1"><?php echo $totalRows_rsClubsearch ?></font> <a href="<?php printf("%s?pageNum_rsClubsearch=%d%s", $currentPage, min($totalPages_rsClubsearch, $pageNum_rsClubsearch + 1), $queryString_rsClubsearch); ?>">Next</a>
</caption>
<tr bgcolor="#999999">
<td height="20"><strong><font color="#FFFFFF">club</font></strong></td>
<td><strong><font color="#FFFFFF">town</font></strong></td>
<td><strong><font color="#FFFFFF">county</font></strong></td>
<td><font color="#FFFFFF">Country</font></td>
</tr>
<?php do { ?>
<tr>
<td height="21"><?php echo $row_rsClubsearch['Golfclubname']; ?></td>
<td><?php echo $row_rsClubsearch['town']; ?></td>
<td><?php echo $row_rsClubsearch['county']; ?></td>
<td><?php echo $row_rsClubsearch['Country']; ?></td>
</tr>
<tr>
<td height="21" colspan="4"><?php echo $row_rsClubsearch['details']; ?></td>
</tr>
<?php } while ($row_rsClubsearch = mysql_fetch_assoc($rsClubsearch)); ?>
</table>
<p> </p>
<?php if ($totalRows_rsClubsearch == 0) { // Show if recordset empty ?>
<p align="center"><strong><font color="#FF0000" size="3">Sorry but
no records were found please try again</font></strong></p>
<p align="center"><strong><font color="#000000" size="3"><a href="clubsearch6.php">Search</a></font></strong></p>
<?php } // Show if recordset empty ?></td>
<td width="1%" valign="top"><img src="images/right.jpg" width="14" height="458"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2%" height="30"> </td>
<td width="97%" align="center" background="images/dwnover.jpg" style="background-repeat:no-repeat "><a href="privacy.php"><font color="#FFFFFF">Privacy
Statement </font></a> <img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u3.jpg" width="105" height="6" border="0"></a><img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u4.jpg" width="115" height="7" border="0"></a><img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u5.jpg" width="54" height="6" border="0"></a><img src="images/u2.jpg" width="3" height="10"><a href="#"><img src="images/u6.jpg" width="72" height="6" border="0"></a><img src="images/u2.jpg" width="3" height="10"><font color="#FFFFFF">
<?php echo $row_rsSiteinfo['copyright']; ?></font></td>
<td width="1%"> </td>
</tr>
</table></td>
<td width="60%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="86"></td>
</tr>
<tr>
<td height="469" background="images/right.jpg" style="background-repeat:repeat-x "></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsClubsearch);
?>
THanks for your assistance, may be one day I'll be able to help you.