I execute a rather simple mysql query and return the results to a table. There were three entries in db, and the query is retrieved from two tables. As a result, I get a count of three records (mysql_num_rows echo messages), but only two tables are displayed in the table. Using the print_r command in the results of an array shows only one specific record - the other records show in print-r .. I added another record in db and now three records are displayed - the same record as before is not displayed and is the only one an entry in the print_r command. Here is the relevant code:
<td id="page1"> <?php $limit = 15; // Set limit to show for pagination $page = $_GET['page']; // get page number from submit if($page) $start = ($page - 1) * $limit; // first item to display on this page else $start = 0; // if no page var is given, set start to 0 $query = "SELECT PartyMstr.PartyMstrID, UserName, FirstName, LastName, XrefPartyRoleID FROM PartyMstrRole, PartyMstr WHERE PartyMstr.PartyMstrID = PartyMstrRole.PartyMstrID && PartyMstrRole.XrefPartyRoleID = 1 ORDER BY LastName, FirstName ASC LIMIT $start, $limit "; $result = mysql_query($query, $connection); $row = mysql_fetch_array($result) or die(mysql_error()); $totalitems1 = mysql_num_rows($result); ?> <center><h3> Admin User List </h3></center> <?php echo "<table border=\"1\" align=\"center\">"; echo "<tr><th>PartyMaster ID</th>"; echo "<th>UserName</th>"; echo "<th>Last, First</th>"; echo "<th>Link</th></tr>"; while($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo $row['PartyMstrID']; echo "<td>"; echo $row['UserName']; echo "<td>"; echo " " . $row['LastName'] . ", " . $row['FirstName'] . " "; echo "<td>"; echo "<a href = \"http://www.505575.com/editUser.php?id=" . $row['PartyMstrID'] . "\" >Edit</a>"; // echo "<td>"; // echo $row['XrefPartyRoleID']; echo "</td></tr>"; } echo "</table><br/><br/> "; $paginaton = getPaginationString( $page, $totalitems, $limit, $adjacents = 1, $targetpage = "adminUserList.php", $pagestring = "?page=" ); // Functon found in functions.php echo $paginaton; ?> </td>
I spent a lot of time on the Internet looking for explanations without success. I disabled the $pagination line of code without effect. I tried various other tricks and repeated the conclusion. The number of rows returned ( n ) is always correct, but only n-1 rows are displayed in the table. Any ideas there?
Thanks - Don
source share