RE: [PHP] mssql_fetch_row();

From: Date: Fri, 11 Apr 2003 14:47:50 +0000
Subject: RE: [PHP] mssql_fetch_row();
Groups: php.general 
Request: Send a blank email to php-general+get-143511@lists.php.net to get a copy of this message
Thanks for the tip. THe thing is, I don't know which row number these "next 20 entries" are. If you notice in my query "SELECT * FROM updateHISTORY WHERE AIX = '$search' ORDER BY VAX"; These data, it any rows in the table wherever the field "AIX" = $search...and the pulled out data is sorted by the field VAX from a to z...so to find out the row number of each of the 21st to 40th entries is impossible. If I start my row from the 20th row like you said..it would just pull out the 21st to 40th row....but I want the 21st to 40th entries of data WHERE the AIX field is $search and their order is sorted by the VAX field. AM I being clear? Thanks a lot anyway Kelvin -----Original Message----- From: CPT John W. Holmes [mailto:holmes072000@charter.net] Sent: Friday, April 11, 2003 10:40 AM To: Poon, Kelvin (Infomart); php-general@lists.php.net Subject: Re: [PHP] mssql_fetch_row(); > 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...

« previous php.general (#143511) next »