heh ;)

I'd love it if it did.  But alas, LIMIT is actually a hack I came up with
years ago for mSQL which was brought into MySQL and enhanced.  If it ever
makes it into MSSQL or Oracle I'll charge big-time royalties or
something...

-Rasmus

On Mon, 6 May 2002, olinux wrote:

> Does MSSQL not have a LIMIT clause?
>
> $offset = ($page - 1) * $numDisplay
> i.e. SELECT * FROM $table WHERE whatever = '$blah'
> LIMIT $offset, $numDispay
>
> olinux
>
> --- RS Herhuth <[EMAIL PROTECTED]> wrote:
> > 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&currentPage=$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
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to