downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mysqli_result::fetch_array> <mysqli_result::data_seek
Last updated: Fri, 20 May 2011

view this page in

mysqli_result::fetch_all

mysqli_fetch_all

(PHP 5 >= 5.3.0)

mysqli_result::fetch_all -- mysqli_fetch_allObtener todas las filas en un array asociativo, numérico, o en ambos

Descripción

Estilo orientado a objetos

mixed mysqli_result::fetch_all ([ int $resulttype = MYSQLI_NUM ] )

Estilo por procesos

mixed mysqli_fetch_all ( mysqli_result $result [, int $resulttype = MYSQLI_NUM ] )

mysqli_fetch_all() consulta todas las filas y devuelve el resultado en un array asociativo, numérico, o ambos.

Parámetros

result

Sólo estilo procedimental: Un conjunto de identificadores de resultados devuelto por mysqli_query(), mysqli_store_result() o mysqli_use_result().

resulttype

Este parámetro opcional define mediante una constante qué tipo de array debe producirse a partir de los datos actuales. Los valores posibles para este parámetro son las constantes MYSQLI_ASSOC, MYSQLI_NUM, o MYSQLI_BOTH.

Valores devueltos

Devuelve un array asociativo o numérico que almacena el resultado.

MySQL Native Driver Only

Disponible sólo con mysqlnd.

Dado que mysqli_fetch_all() devuelve todas las filas en un array en un solo paso, puede consumir más memoria que otras funciones similares tales como mysqli_fetch_array(), que sólo devuelve una fila cada vez a partir del resultado. Por tanto, si se necesita recorrer un resultado, será necesario un bucle que minimice el impacto en rendimiento. Por esta razón, se aconseja que sólo se use mysqli_fetch_all() en aquellas situaciones en que el resultado se tenga que enviar a otra capa o nivel para que lo procese.

Ver también



mysqli_result::fetch_array> <mysqli_result::data_seek
Last updated: Fri, 20 May 2011
 
add a note add a note User Contributed Notes mysqli_result::fetch_all
windix at gmail dot com 26-Aug-2010 02:01
If you get an empty set after calling fetch_all(), make sure the result set cursor is reset to the beginning
andrey at php dot net 10-Aug-2010 02:38
Return value changed in 5.3.3 - between 5.3.0 and 5.3.2 (incl.) when the result set was empty NULL was returned. 5.3.3+ returns an empty array.
Also, mysqli_fetch_all works only for buffered result sets, which are the default for mysqli_query. MYSQLI_USE_RESULT will be supported in 5.3.4+
However, it makes little sense to use it this way, materialising unbuffered sets. In this case choose STORE_RESULT, and fetch_all won't copy the data, but reference it, as it is stored already in mysqlnd.
kevin at metalaxe dot com 06-Jan-2009 09:18
If you are getting the following error:

Fatal error: Call to undefined method mysqli_result::fetch_all()

Be sure you didn't miss this line after the procedural call about it requiring mysqlnd

 
show source | credits | stats | sitemap | contact | advertising | mirror sites