Switch to: V11V10V9V8V7V6V5

valentina_fetch_lengths()

Declaration

array valentina_fetch_lengths ( resource result )

Parameters

Name Description
result The result resource that is being evaluated. This result comes from a call to valentina_query().

Description

Returns an array that corresponds to the lengths of each field in the last row fetched by VServer.

valentina_fetch_lengths() stores the lengths of each result column in the last row returned by valentina_fetch_row(), valentina_fetch_assoc(), valentina_fetch_array(), and valentina_fetch_object() in an array, starting at offset 0.

Return Values

An array of lengths on success, or FALSE on failure.

Examples

Example 1.

<?php
$result = valentina_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
   echo 'Could not run query: ' . valentina_error();
   exit;
}
$row    = valentina_fetch_assoc($result);
$lengths = valentina_fetch_lengths($result);
 
print_r($row);
print_r($lengths);
?>  

The above example will output something similar to:

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

See Also