downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mssql_fetch_field> <mssql_fetch_assoc
[edit] Last updated: Sat, 07 Jan 2012

view this page in

mssql_fetch_batch

(PHP 4 >= 4.0.4, PHP 5, PECL odbtp >= 1.1.1)

mssql_fetch_batchReturns the next batch of records

설명

int mssql_fetch_batch ( resource $result )

Returns the next batch of records

인수

result

The result resource that is being evaluated. This result comes from a call to mssql_query().

반환값

Returns the batch number as an integer.

예제

Example #1 mssql_fetch_batch() example

<?php
// Connect to MSSQL and select the database
$link mssql_connect('MANGO\SQLEXPRESS''sa''phpfi');
mssql_select_db('php'$link);

// Send a query
$result mssql_query('SELECT * FROM [php].[dbo].[people]'$link100);
$records 10;

while (
$records >= 0) {
    while (
$row mssql_fetch_assoc($result)) {
        
// Do stuff ...
    
}

    --
$records;
}

if (
$batchsize mssql_fetch_batch($result)) {
    
// $batchsize is the number of records left 
    // in the result, but not shown above
}
?>



add a note add a note User Contributed Notes mssql_fetch_batch
brutalex430 13-Jul-2010 01:34
This could be usefull if you have a large dataset:

<?php
$qry
= mssql_query("SELECT * FROM huge_table", $conn, 1000); // 1000 Rows batchsize

   
do {
      while (
$row = mssql_fetch_row($qry)) {
         
// do something like
         
print_r($row);
      }
    } while (
mssql_fetch_batch($navqry));  // get the next batch until end

?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites