Re: mssql_fetch_row();
| From: | CPT John W. Holmes | Date: | Fri, 11 Apr 2003 14:40:16 +0000 |
| Subject: | Re: mssql_fetch_row(); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143509@lists.php.net to get a copy of this message | ||
> In my script, I take our the first 20 entries of my SQL table like this:
>
> $query = "SELECT * FROM updateHistory WHERE AIX = '$search' ORDER BY VAX";
> $result = mssql_query($query);
>
> for ($i = $start; $i < mssql_num_rows($result); ++$i)
Why don't you just go up to 20 (or $start +20) instead of num_rows()??
> {
> $updateHistory = mssql_fetch_row($result);
>
> // code here....
>
>
> $numRecord+=1;
> if ($numRecord==20) {
> break;
> }
> }
>
> THis code successfully processing the first 20 entries of the data I took
> out from the query. My question is, how do I take out the 21st to the
40th
> entries?...or 41st to 60th entries?..basically I want it to function so
that
> it can process the 'next 20' each time.
Use this function to jump to the 20th row, and then start your loop. To
display 41-60, you need to select 60 rows, jump to row 41 and then start
displaying.
http://www.php.net/manual/en/function.mssql-data-seek.php
---John Holmes...