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

search for in the

mysql_fetch_object> <mysql_fetch_field
[edit] Last updated: Sat, 07 Jan 2012

view this page in

mysql_fetch_lengths

(PHP 4, PHP 5)

mysql_fetch_lengths결과로부터 각 출력의 길이를 반환

설명

array mysql_fetch_lengths ( resource $result )

MySQL에 의해 인출된 마지막 행에서 각 필드의 길이를 배열로 반환한다.

mysql_fetch_lengths()mysql_fetch_row(), mysql_fetch_assoc(), mysql_fetch_array(), mysql_fetch_object()에 의해 반환된 마지막 행의 각 컬럼 길이를 0으로 시작하는 배열로 반환한다.

인수

result

mysql_query() 호출을 통한 결과 resource.

반환값

성공할 경우 array를 실패할 경우 FALSE를 반환한다.

예제

Example #1 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);
?>

위 예제의 출력 예시:

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

참고



add a note add a note User Contributed Notes mysql_fetch_lengths
Bavo Janss 10-Jul-2009 07:19
In case of UTF8 fields mysql_field_len() will return 3 times the maximum length (e.g. 30 for a VARCHAR(10) field)) for mysql_field_len() returns the byte length of the field not the defined size.
09-Feb-2006 06:23
For the maximum length of a field (e.g. 10 for a VARCHAR(10) field), use mysql_field_len().

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