Forum und email

mysql_field_len

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

mysql_field_len — Returns the length of the specified field

Popis

int mysql_field_len ( resource $result , int $field_offset )

mysql_field_len() returns the length of the specified field.

Parametre

result

Výsledný resource, ktorý je vyhodnocovaný. Tento výsledok pochádza z volania mysql_query().

field_offset

Ofset číselného poľa. Field_offset začína na 0. Ak field_offset neexistuje, je tiež vytvorený error úrovne E_WARNING.

Vrátené hodnoty

The length of the specified field index on success, or FALSE on failure.

Príklady

Example#1 mysql_field_len() example

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

// Will get the length of the id field as specified in the database
// schema. 
$length mysql_field_len($result0);
echo 
$length;
?>

Poznámky

Note: Pre spätný kompatibilitu, nasledujúci zastaraný alias môže byť použitý: mysql_fieldlen()