1 Reply Latest reply on Sep 16, 2008 6:53 PM by speytay

    Recordset pages show up blank

    speytay
      When my recordset is returned, the first page shows up perfectly. If I have, for example, 22 records, they will all show up on that page. But, if I restrict each page to 10 records, the first page shows up with 10 records, but the second and third page will be blank. And when I navigate back to the first page, it too is now blank.

      There are multiple dynamic elements in a single cell, but this is working fine ( at least on the first page ).

      The Navigation Bar works fine and the Navigation Status also works fine ( for example, Page 2 will show "Records 11 - 20 of 22" ), but the page is blank. What is going on here!

      I am using MySQL, Apache, PHP, DWCS3 and Windows Vista.

      Attach Code

      <?php require_once('Connections/connB.php'); ?>
      <?php
      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch ($theType) {
      case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
      case "long":
      case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
      case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
      case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
      case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
      }
      return $theValue;
      }
      }

      $currentPage = $_SERVER["PHP_SELF"];

      $maxRows_Recordset1 = 10;
      $pageNum_Recordset1 = 0;
      if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
      }
      $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

      $varstate_Recordset1 = "1";
      if (isset($_POST['state'])) {
      $varstate_Recordset1 = $_POST['state'];
      }
      $varbusinessName_Recordset1 = "1";
      if (isset($_POST['businessName'])) {
      $varbusinessName_Recordset1 = $_POST['businessName'];
      }
      $varcity_Recordset1 = "1";
      if (isset($_POST['city'])) {
      $varcity_Recordset1 = $_POST['city'];
      }
      $varcategory_Recordset1 = "1";
      if (isset($_POST['category'])) {
      $varcategory_Recordset1 = $_POST['category'];
      }
      mysql_select_db($database_connB, $connB);
      $query_Recordset1 = sprintf("SELECT states.state, categories.category, cities.city, customers.businessName, customers.website, customers.email, images.image, images.printedBy FROM states, categories, cities, customers, images WHERE %s = states.state AND states.stateID = customers.stateID AND %s = cities.city AND cities.cityID = customers.cityID AND %s = categories.category AND categories.categoryID = images.categoryID AND images.customerID = customers.customerID OR %s LIKE customers.businessName AND customers.cityID = cities.cityID AND customers.stateID = states.stateID AND customers.customerID = images.customerID AND images.categoryID = categories.categoryID", GetSQLValueString($varstate_Recordset1, "text"),GetSQLValueString($varcity_Recordset1, "text"),GetSQLValueString($varcategory_Recordset1, "text"),GetSQLValueString($varbusinessName_Recordset1, "text"));
      $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
      $Recordset1 = mysql_query($query_limit_Recordset1, $connB) or die(mysql_error());
      $row_Recordset1 = mysql_fetch_assoc($Recordset1);

      if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
      } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
      }
      $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

      $queryString_Recordset1 = "";
      if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
      if (stristr($param, "pageNum_Recordset1") == false &&
      stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
      }
      }
      if (count($newParams) != 0) {
      $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
      }
      }
      $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
      ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">

      <div id="mainContent">
      <h2> Search Results:</h2>
      <p> </p>
      <table width="641" height="184" border="1">
      <tr>
      <td width="345">Company Information</td>
      <td width="280">Business</td>
      </tr>
      <?php do { ?>
      <tr>
      <td height="156"><span class="style3"></span>
      <p class="style9"><?php echo $row_Recordset1['category']; ?></p>
      <p class="style9"><?php echo $row_Recordset1['businessName']; ?> <span class="fltrt style4"><?php echo $row_Recordset1['website']; ?></span></p>
      <p><span class="style4"><?php echo $row_Recordset1['city']; ?></span>, <span class="style4"><?php echo $row_Recordset1['state']; ?> </span><span class="fltrt style4"><?php echo $row_Recordset1['email']; ?></span></p>
      <p class="style4">
      <p class="style4"> </p></td>
      <td><img src="images/<?php echo $row_Recordset1['image']; ?>" name="rs1image" id="rs1image" />
      <p class="style4"><span class="fltrt"><?php echo $row_Recordset1['printedBy']; ?></span></p></td>
      </tr>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      </table>
      <p class="style4"><?php echo $row_Recordset1['image']; ?></p>
      <p> </p>
      <p> 

      <table border="0">
      <tr>
      <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>"><img src="images/First.gif" border="0" /></a>
      <?php } // Show if not first page ?>
      </td>
      <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>"><img src="images/Previous.gif" border="0" /></a>
      <?php } // Show if not first page ?>
      </td>
      <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>"><img src="images/Next.gif" border="0" /></a>
      <?php } // Show if not last page ?>
      </td>
      <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>"><img src="images/Last.gif" border="0" /></a>
      <?php } // Show if not last page ?>
      </td>
      </tr>
      </table>
      </p>
      <p> 
      Business <?php echo ($startRow_Recordset1 + 1) ?> - <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?> </p>

      <!-- end #mainContent --></div>
      <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
      <div id="footer">
      <p>Footer</p>
      <!-- end #footer --></div>
      <!-- end #container --></div>
      </body>
      </html>
      <?php
      mysql_free_result($Recordset1);
      ?>