List,

I'm trying to write a script that only returns x number of results from
a query per page.  I have all the logic in place that should do the
trick but the one problem I'm having is getting the SQL query to work
for me.

BTW I'm suing Microsoft SQL Server 2000, not My SQL.  I know that MySQL
has the LIMIT attribute, but that doesn't work with MSSQL.

The problem I'm having specifically is that I can't bring back say only
rows 10-15 for example.

This is what I'm using (danger code from memory):

...
//the next set of variables are dynamically set in the actual script
$currentPage = 2;
$numOfPages = 5;
$dispPerPage = 5;
$lwr = ($dispPerPage  * $currentPage); 
$lwr = ($dispPerPage  * $currentPage) + $dispPerPage;

for($i = $lwr; $i < $upr; $i++){
        $row = mssql_fetch_row($i, $result);
        echo "$row[first_name] $row[last_name]";
}


if (($currentPage + 1) < $numOfPages){
        $nextPage = $currentPage + 1;
        echo "<a href='this_page.php?currentPage=$nextPage'>next page</a>
}




The first page works fine.  The next page comes back with an index
related error.  I suspect it has to do with this line:
$row = mssql_fetch_row($i, $result);

What mssql command should I be using so that I can control the reults
that I am returning?

Thanks,
Ron

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to