PHP Velho Oeste 2024

ifx_fetch_row

(PHP 4, PHP 5 < 5.2.1)

ifx_fetch_rowObtener una fila en forma de arraglo asociativo

Descripción

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

Extrae una fila con datos del resultado asociado con el identificador especificado.

Las llamadas subsecuentes a ifx_fetch_row() devolverán la siguiente fila, o FALSE si no hay más filas.

Parámetros

result_id

result_id es el identificador válido devuelto por ifx_query() o ifx_prepare() (solo para consultas "SELECT").

position

Parámetro opcional para extraer datos en cursores "scroll": NEXT, PREVIOUS, CURRENT, FIRST, LAST o un número. Si se especifica un número se extrae la fila absoluta correspondiete.

Valores devueltos

Devuelve un arreglo asociativo correspondiente a la fila extraida, o FALSE si ya no hay más filas.

Las columnas BLOB son devueltas como identificadores BLOB enteros que pueden ser utilizados en ifx_get_blob() a menos que se haya utilizado ifx_textasvarchar(1) o ifx_byteasvarchar(1), de ser así las columnas BLOB son devueltas como cadenas.

Ejemplos

Ejemplo #1 Extraer filas Informix

<?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 ("Demasiadas filas en el bloque (%d)\n<br />"$rowcount);
    die (
"Por favor limite su consulta<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);
?>

add a note add a note

User Contributed Notes 1 note

up
1
rpuchalsky at att dot net
23 years ago
If you use a select statement that
identifies fields according to which
table they come from, i.e.

select tab1.name, tab2.phone from
tab1, tab2
where tab1.id = tab2.id

then the associative keys of the array returned by ifx_fetch_row will not include the table names.  For the example above, if you used

$row = ifx_fetch_row ($rid);

then the first field in the
returned array would be $row["name"],
not $row["tab1.name"] .
To Top