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); ?>
|
|