PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<ocifetchintoocifreecollection>
Last updated: Mon, 16 Jul 2012

ocifetchstatement

(PHP 3 >= 3.0.8, PHP 4, PHP 5)

ocifetchstatement -- »ñÈ¡½á¹ûÊý¾ÝµÄËùÓÐÐе½Ò»¸öÊý×é

ÃèÊö

int ocifetchstatement ( resource stmt, array &output [, int skip [, int maxrows [, int flags]]] )

ocifetchstatement() ´ÓÒ»¸ö½á¹ûÖлñÈ¡ËùÓеÄÐе½Ò»¸ö Óû§¶¨ÒåµÄÊý×é¡£ ocifetchstatement() ·µ»Ø»ñÈ¡µÄÐÐÊý¡£ skip ÊÇ´Ó½á¹ûÖлñÈ¡Êý¾Ýʱ£¬×ʼºöÂÔµÄÐÐÊý (¸Ã²ÎÊýµÄĬÈÏÖµÊÇ 0£¬¼´´ÓµÚÒ»ÐпªÊ¼)¡£ maxrows ÊǶÁÈ¡µÄÐÐÊý£¬´ÓµÚ skip ÐпªÊ¼ (ĬÈÏÖµÊÇ -1£¬¼´ËùÓÐÐÐ)¡£

flags ±íʾ´æÔÚµÄÑ¡Ï ¿ÉÒÔÊÇÏÂÁÐÈÎÒ»µÄ×éºÏ£º

OCI_FETCHSTATEMENT_BY_ROW
OCI_FETCHSTATEMENT_BY_COLUMN (ĬÈÏÖµ)
OCI_NUM
OCI_ASSOC

例子 1. ocifetchstatement()

<?php
/* OCIFetchStatement example mbritton at verinet dot com (990624) */

$conn = OCILogon("scott", "tiger");

$stmt = OCIParse($conn, "select * from emp");

OCIExecute($stmt);

$nrows = OCIFetchStatement($stmt, $results);
if (
$nrows > 0) {
   echo
"<table border=\"1\">\n";
   echo
"<tr>\n";
   while (list(
$key, $val) = each($results)) {
     echo
"<th>$key</th>\n";
   }
   echo
"</tr>\n";
  
   for (
$i = 0; $i < $nrows; $i++) {
    
reset($results);
     echo
"<tr>\n";
     while (
$column = each($results)) { 
        
$data = $column['value'];
         echo
"<td>$data[$i]</td>\n";
     }
     echo
"</tr>\n";
   }
   echo
"</table>\n";
} else {
   echo
"No data found<br />\n";
}     
echo
"$nrows Records Selected<br />\n";
 
OCIFreeStatement($stmt);
OCILogoff($conn);
?>




<ocifetchintoocifreecollection>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST