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

search for in the

mysql_fetch_object> <mysql_fetch_field
Last updated: Fri, 22 Aug 2008

view this page in

mysql_fetch_lengths

(PHP 4, PHP 5, PECL mysql:1.0)

mysql_fetch_lengths Devuelve la longitud de cada salida en un resultado

Descripción

array mysql_fetch_lengths ( int $id_resultado )

Devuelve: Una matriz que contiene las longitudes de cada campo de la última fila extraida por mysql_fetch_row(), o FALSE si error.

mysql_fetch_lengths() almacena las longitudes de cada columna en la última fila devuelta por mysql_fetch_row(), mysql_fetch_assoc(), mysql_fetch_array(), y mysql_fetch_object() en una matriz, empezando por 0.

Vea también mysql_field_len(), mysql_fetch_row(), strlen().

Example #1 Ejemplo de mysql_fetch_lengths

<?php
$result 
mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!
$result) {
    echo 
'Could not run query: ' mysql_error();
    exit;
}
$row     mysql_fetch_assoc($result);
$lengths mysql_fetch_lengths($result);

print_r($row);
print_r($lengths);

?>

El resultado del ejemplo seria algo similar a:

Array
(
    [id] => 42
    [email] => user@example.com
)
Array
(
    [0] => 2
    [1] => 16
)



add a note add a note User Contributed Notes
mysql_fetch_lengths
10-Feb-2006 03:23
For the maximum length of a field (e.g. 10 for a VARCHAR(10) field), use mysql_field_len().

mysql_fetch_object> <mysql_fetch_field
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites