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"] .
ifx_fetch_row
(No version information available, might be only in CVS)
ifx_fetch_row — Obtiene registros como un array (vector) enumerado
Descripción
Devuelve un array (vector) correspondiente a la fila leída o FALSE si no hay más registros.
Las columnas blob son devueltas como identificadores de blob enteros (integer) para usarlos con ifx_get_blob() a menos que hayas usado ifx_textasvarchar(1) o ifx_byteasvarchar(1), en cuyo caso los blobs son devueltos como cadenas de texto. Devuelve FALSE si hubo error.
result_id es un identificador válido del resultado de ifx_query() o ifx_prepare() (sólo para consultas de selección).
position es un parámetro opcional para una operación de lectura sobre un cursor de tipo "scroll": "NEXT" (siguiente), "PREVIOUS" (anterior), "CURRENT" (actual), "FIRST" (primero), "LAST" (último) o un número. Si se especifica un número, un registro concreto es leído. Este parámetro opcional es sólo válido para cursores de tipo scroll.
ifx_fetch_row() lee el contenido de un registro de la consulta representada por el identificador de resultado indicado. La fila (registro) es devuelta en un array. Cada columna es guarda en un array, empezando éste desde cero.
Las llamadas posteriores a ifx_fetch_row() devolverán el registro siguiente en el resultado de la consulta, o FALSE si no hay más filas.
Example #1 Leer registros de Informix
<?php
$rid = ifx_prepare ("select * from emp where name like " . $name,
$connid, IFX_SCROLL);
if (! $rid) {
/* ... error ... */
}
$rowcount = ifx_affected_rows($rid);
if ($rowcount > 1000) {
printf ("Demasiados registros en el resultado (%d)\n<br />", $rowcount);
die ("Por favor, restringe tu 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);
?>
ifx_fetch_row
11-Jan-2001 09:23
