Join Up!
96656 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousmysql_fetch_lengthsmysql_fetch_rownext
Last updated: Tue, 29 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Czech | Finnish | German

mysql_fetch_object

(PHP 3, PHP 4 )

mysql_fetch_object -- Extrae una fila de resultado como un objeto

Descripción

object mysql_fetch_object ( int id_resultado [, int tipo_de_resultado])

Devuelve un objeto con las propiedades aur corresponden a la última fila extraida, o falso si no quedan más filas.

mysql_fetch_object() es similar a mysql_fetch_array(), con la diferencia que un objeto es devuelto en lugar de una matriz. Indirectamente, quiere decir que solo se puede aceder a los datos por el nombre del campo, y no por su posición.

El argumento opcional tipo_de_resultado es una constante y puede tomar los valores siguientes: MYSQL_ASSOC, MYSQL_NUM, y MYSQL_BOTH.

La función es identica a mysql_fetch_array(), y casi tan rápida como mysql_fetch_row() (la diferencia es insignificante).

Ejemplo 1. mysql fetch object

<?php
mysql_connect($host,$user,$password);
$result = mysql_db_query("database","select * from table");
while($row = mysql_fetch_object($result)) {
    echo $row->user_id;
    echo $row->fullname;
}
mysql_free_result($result);
?>

Ver también: mysql_fetch_array() y mysql_fetch_row().

User Contributed Notes
mysql_fetch_object
add a note about notes
There are no user contributed notes for this page.
previousmysql_fetch_lengthsmysql_fetch_rownext
Last updated: Tue, 29 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST