List, I'm pulling my hair out trying to figure out why this is not working. I am trying to limit the number of returns on a page and if need be spread the results over multiple pages. The following is where i believe the problem to be. Please keep in mind I'm using Microsoft SQL Server. The variables are being set properly (I have several places where I'm echoing the results just to be sure). The problem is that the same five names are being returned on each page even though the value of $i is incrementing properly and the correct number of pages are being calculated correctly.
if ($currentPage > 1) { $host="localhost"; $DB="testDB"; $user="sa"; $pass=""; $connect = mssql_connect($host,$user,$pass) or die ($host." not accessible."); if ($DB) mssql_select_db($DB)or die('USE '.$DB.' failed!'); $query = "SELECT first_name, last_name FROM individual WHERE last_name LIKE '$searchField%' ORDER by last_name ASC"; $result = mssql_query($query); $numRows = mssql_num_rows($result); $numPages = ceil($numRows/$numDisplay); echo "Total Rows: $numRows, Results per Page: $numDisplay, Number of Pages: $numPages<br><br>"; $lwr = $currentPage * $numDisplay; $upr = ($currentPage * $numDisplay) + $numDisplay; echo "$lwr, $upr <br><br>"; echo "Current Page: $currentPage<br><br>"; for($i = $lwr; $i < $upr; $i++){ $row = mssql_fetch_row($i,$result); echo "$i, $row[first_name] $row[last_name]<br />"; } if($currentPage < $numPages){ $nextPage = $currentPage + 1; echo "<a href='searchScreen.php?searchField=$searchField¤tPage=$nextPage'>next< /a>"; } } Anyone have any idea why only the same five names might be being returned on each of the pages? I'm not getting something here. Thanks, Ron -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php