Forums
This topic is locked
Recordset Navigation is not showing my Records
Posted 24 Mar 2006 20:04:06
1
has voted
24 Mar 2006 20:04:06 Flowers Noreen posted:
I have a created a recordset navigation for my results page in Dreamweaver MX. The recordset is showing up on the first page but when I navigate to the next page, the table is empty. I have searched everywhere for a solution. Can anyone help, please? Thanks. Replies
Replied 27 Mar 2006 14:02:21
27 Mar 2006 14:02:21 Roddy Dairion replied:
I had the same problem, it has something to do with ur sql query. How do u generate the page?
Replied 28 Mar 2006 02:45:39
28 Mar 2006 02:45:39 Flowers Noreen replied:
I generate the page with a form search using php. The sql was created via php in dreamweaver mx.
Replied 28 Mar 2006 10:42:58
28 Mar 2006 10:42:58 Roddy Dairion replied:
Ok u've to check that the value used to generate the page is being passed on every single page. Can u send me the code please,
Replied 29 Mar 2006 18:56:50
29 Mar 2006 18:56:50 Flowers Noreen replied:
Here is the code, thanks.
$maxRows_getSearchResults = 20;
$pageNum_getSearchResults = 0;
if (isset($_GET['pageNum_getSearchResults'])) {
$pageNum_getSearchResults = $_GET['pageNum_getSearchResults'];
}
$startRow_getSearchResults = $pageNum_getSearchResults * $maxRows_getSearchResults;
$colname2_getSearchResults = "1";
if (isset($_POST['State'])) {
$colname2_getSearchResults = (get_magic_quotes_gpc()) ? $_POST['State'] : addslashes($_POST['State']);
}
$colname_getSearchResults = "1";
if (isset($_POST['LName'])) {
$colname_getSearchResults = (get_magic_quotes_gpc()) ? $_POST['LName'] : addslashes($_POST['LName']);
}
mysql_select_db($database_dbname, $dbname);
$query_getSearchResults = sprintf("SELECT * FROM Members WHERE LName LIKE '%s%%' OR State LIKE '%s%%' ORDER BY LName ASC ", $colname_getSearchResults,$colname2_getSearchResults);
$query_limit_getSearchResults = sprintf("%s LIMIT %d, %d", $query_getSearchResults, $startRow_getSearchResults, $maxRows_getSearchResults);
$getSearchResults = mysql_query($query_limit_getSearchResults, $tumor1) or die(mysql_error());
$row_getSearchResults = mysql_fetch_assoc($getSearchResults);
if (isset($_GET['totalRows_getSearchResults'])) {
$totalRows_getSearchResults = $_GET['totalRows_getSearchResults'];
} else {
$all_getSearchResults = mysql_query($query_getSearchResults);
$totalRows_getSearchResults = mysql_num_rows($all_getSearchResults);
}
$totalPages_getSearchResults = ceil($totalRows_getSearchResults/$maxRows_getSearchResults)-1;
$queryString_getSearchResults = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_getSearchResults" == false &&
stristr($param, "totalRows_getSearchResults" == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_getSearchResults = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_getSearchResults = sprintf("&totalRows_getSearchResults=%d%s", $totalRows_getSearchResults, $queryString_getSearchResults);
?>
<p align="left" class="header"><span class="body"><br>
<span class="style63"><?php echo ($startRow_getSearchResults + 1) ?> of <?php echo $totalRows_getSearchResults ?></span></span> </p>
<table width="95%" border="1" cellspacing="0" cellpadding="0">
<tr bgcolor="#3399CC" class="body">
<td height="21"><strong>Name <span class="style61">(click name for more details)</span> </strong></td>
<td><strong>City</strong></td>
<td><strong>State</strong></td>
<td><strong>Zip</strong></td>
<td><strong>Country</strong></td>
</tr>
<?php do { ?>
<tr class="body">
<td height="21"><a href="/membersonly/members/membersDetail.php?Id=<?php echo $row_getSearchResults['Id']; ?>"><?php echo $row_getSearchResults['LName']; ?>, <?php echo $row_getSearchResults['Fname']; ?>, </a><a href="/membersonly/members/membersDetail.php?Id=<?php echo $row_getSearchResults['Id']; ?>"><?php echo $row_getSearchResults['Suffix']; ?></a></td>
<td><?php echo $row_getSearchResults['City']; ?></td>
<td><?php echo $row_getSearchResults['State']; ?></td>
<td><?php echo $row_getSearchResults['WorkPhone']; ?></td>
<td><?php echo $row_getSearchResults['Country']; ?></td>
</tr>
<?php } while ($row_getSearchResults = mysql_fetch_assoc($getSearchResults)); ?>
</table>
<br>
<table width="50%" height="22" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, 0, $queryString_getSearchResults); ?>">First</a></strong></div></td>
<td width="28%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, max(0, $pageNum_getSearchResults - 1), $queryString_getSearchResults); ?>">Previous</a></strong></div></td>
<td width="22%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, min($totalPages_getSearchResults, $pageNum_getSearchResults + 1), $queryString_getSearchResults); ?>">Next</a></strong></div></td>
<td width="30%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, $totalPages_getSearchResults, $queryString_getSearchResults); ?>">Last</a></strong></div></td>
</tr>
</table>
<br>
<p align="left" class="style62"> </p>
</HTML>
<?php
mysql_free_result($getSearchResults);
?>
$maxRows_getSearchResults = 20;
$pageNum_getSearchResults = 0;
if (isset($_GET['pageNum_getSearchResults'])) {
$pageNum_getSearchResults = $_GET['pageNum_getSearchResults'];
}
$startRow_getSearchResults = $pageNum_getSearchResults * $maxRows_getSearchResults;
$colname2_getSearchResults = "1";
if (isset($_POST['State'])) {
$colname2_getSearchResults = (get_magic_quotes_gpc()) ? $_POST['State'] : addslashes($_POST['State']);
}
$colname_getSearchResults = "1";
if (isset($_POST['LName'])) {
$colname_getSearchResults = (get_magic_quotes_gpc()) ? $_POST['LName'] : addslashes($_POST['LName']);
}
mysql_select_db($database_dbname, $dbname);
$query_getSearchResults = sprintf("SELECT * FROM Members WHERE LName LIKE '%s%%' OR State LIKE '%s%%' ORDER BY LName ASC ", $colname_getSearchResults,$colname2_getSearchResults);
$query_limit_getSearchResults = sprintf("%s LIMIT %d, %d", $query_getSearchResults, $startRow_getSearchResults, $maxRows_getSearchResults);
$getSearchResults = mysql_query($query_limit_getSearchResults, $tumor1) or die(mysql_error());
$row_getSearchResults = mysql_fetch_assoc($getSearchResults);
if (isset($_GET['totalRows_getSearchResults'])) {
$totalRows_getSearchResults = $_GET['totalRows_getSearchResults'];
} else {
$all_getSearchResults = mysql_query($query_getSearchResults);
$totalRows_getSearchResults = mysql_num_rows($all_getSearchResults);
}
$totalPages_getSearchResults = ceil($totalRows_getSearchResults/$maxRows_getSearchResults)-1;
$queryString_getSearchResults = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_getSearchResults" == false &&
stristr($param, "totalRows_getSearchResults" == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_getSearchResults = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_getSearchResults = sprintf("&totalRows_getSearchResults=%d%s", $totalRows_getSearchResults, $queryString_getSearchResults);
?>
<p align="left" class="header"><span class="body"><br>
<span class="style63"><?php echo ($startRow_getSearchResults + 1) ?> of <?php echo $totalRows_getSearchResults ?></span></span> </p>
<table width="95%" border="1" cellspacing="0" cellpadding="0">
<tr bgcolor="#3399CC" class="body">
<td height="21"><strong>Name <span class="style61">(click name for more details)</span> </strong></td>
<td><strong>City</strong></td>
<td><strong>State</strong></td>
<td><strong>Zip</strong></td>
<td><strong>Country</strong></td>
</tr>
<?php do { ?>
<tr class="body">
<td height="21"><a href="/membersonly/members/membersDetail.php?Id=<?php echo $row_getSearchResults['Id']; ?>"><?php echo $row_getSearchResults['LName']; ?>, <?php echo $row_getSearchResults['Fname']; ?>, </a><a href="/membersonly/members/membersDetail.php?Id=<?php echo $row_getSearchResults['Id']; ?>"><?php echo $row_getSearchResults['Suffix']; ?></a></td>
<td><?php echo $row_getSearchResults['City']; ?></td>
<td><?php echo $row_getSearchResults['State']; ?></td>
<td><?php echo $row_getSearchResults['WorkPhone']; ?></td>
<td><?php echo $row_getSearchResults['Country']; ?></td>
</tr>
<?php } while ($row_getSearchResults = mysql_fetch_assoc($getSearchResults)); ?>
</table>
<br>
<table width="50%" height="22" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, 0, $queryString_getSearchResults); ?>">First</a></strong></div></td>
<td width="28%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, max(0, $pageNum_getSearchResults - 1), $queryString_getSearchResults); ?>">Previous</a></strong></div></td>
<td width="22%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, min($totalPages_getSearchResults, $pageNum_getSearchResults + 1), $queryString_getSearchResults); ?>">Next</a></strong></div></td>
<td width="30%" class="body"><div align="center"><strong><a href="<?php printf("%s?pageNum_getSearchResults=%d%s", $currentPage, $totalPages_getSearchResults, $queryString_getSearchResults); ?>">Last</a></strong></div></td>
</tr>
</table>
<br>
<p align="left" class="style62"> </p>
</HTML>
<?php
mysql_free_result($getSearchResults);
?>
Replied 30 Mar 2006 10:50:38
30 Mar 2006 10:50:38 Roddy Dairion replied:
Just a question:
Is this a search page?
If yes then you must be using a form to post the value in the search page.
If the u'r using a form to post a value to start the search then u must make sure that the value being posted is kept all alone across the page(pagination)
If u hve another form can u post it as well please thx.
Is this a search page?
If yes then you must be using a form to post the value in the search page.
If the u'r using a form to post a value to start the search then u must make sure that the value being posted is kept all alone across the page(pagination)
If u hve another form can u post it as well please thx.
Replied 30 Mar 2006 11:01:21
30 Mar 2006 11:01:21 Roddy Dairion replied:
I tested the code u sent to me and its seems that everything works fine when i remove the where clause and the $tumor1 in the code. By the way where are u declaring $tumor1??