ifx_fetch_row

(PHP 4, PHP 5 < 5.2.1)

ifx_fetch_rowGet row as an associative array

说明

ifx_fetch_row ( resource $result_id [, mixed $position ] ) : array

Fetches one row of data from the result associated with the specified result identifier.

Subsequent calls to ifx_fetch_row() would return the next row in the result set, or FALSE if there are no more rows.

参数

result_id

result_id is a valid resultid returned by ifx_query() or ifx_prepare() (select type queries only!).

position

An optional parameter for a "fetch" operation on "scroll" cursors: NEXT, PREVIOUS, CURRENT, FIRST, LAST or a number. If you specify a number, an "absolute" row fetch is executed. This parameter is optional, and only valid for SCROLL cursors.

返回值

Returns an associative array that corresponds to the fetched row, or FALSE if there are no more rows.

Blob columns are returned as integer blob id values for use in ifx_get_blob() unless you have used ifx_textasvarchar(1) or ifx_byteasvarchar(1), in which case blobs are returned as string values.

范例

Example #1 Informix fetch rows

<?php
$rid 
ifx_prepare ("select * from emp where name like " $name,
                     
$connidIFX_SCROLL);
if (! 
$rid) {
    
/* ... error ... */
}
$rowcount ifx_affected_rows($rid);
if (
$rowcount 1000) {
    
printf ("Too many rows in result set (%d)\n<br />"$rowcount);
    die (
"Please restrict your query<br />\n");
}
if (! 
ifx_do ($rid)) {
   
/* ... error ... */
}
$row ifx_fetch_row ($rid"NEXT");
while (
is_array($row)) {
    for (
reset($row); $fieldname=key($row); next($row)) {
        
$fieldvalue $row[$fieldname];
        
printf ("%s = %s,"$fieldname$fieldvalue);
    }
    
printf("\n<br />");
    
$row ifx_fetch_row($rid"NEXT");
}
ifx_free_result ($rid);
?>

相关文章
php cubrid mysql 兼容性函数 fetch a result row as an associative array a numeric array or bothphp cubrid mysql 兼容性函数 return the associative array that corresponds to the fetched rowphp date/time 函数 returns associative array with detailed info about given datephp frontbase 函数 fetch a result row as an associative array a numeric array or bothphp frontbase 函数 fetch a result row as an associative arrayphp gopher 函数 translate a gopher formatted directory entry into an associative arrayphp firebird/interbase 函数 fetch a result row from a query as an associative arrayphp informix 函数 get row as an associative arrayphp ingres 函数 fetch a row of result into an associative arrayphp mailparse 函数 returns an associative array of info about the messagephp maxdb 函数 fetch a result row as an associative a numeric array or bothphp maxdb 函数 fetch a result row as an associative arrayphp mssql 函数 fetch a result row as an associative array a numeric array or bothphp mssql 函数 returns an associative array of the current row in the resultphp oci8 函数 returns the next row from a query as an associative or numeric arrayphp oci8 函数 returns the next row from a query as an associative arrayphp odbc 函数 fetch a result row as an associative arrayphp odbc 函数 fetch one result row into arrayphp sqlite 函数 executes a query and returns either an array for one single column or the value of the first rowphp sybase 函数 fetch a result row as an associative array
关注编程学问公众号