Switch to: V11V10V9V8V7V6V5

valentina_field_name()

Declaration

string valentina_field_name ( 
                resource result, 
                int field_offset )

Parameters

Name Description
result The result resource that is being evaluated. This result comes from a call to valentina_query().
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist, an error of level E_WARNING is also issued.

Description

Returns the name of the specified field index.

Return Values

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

Examples

Example 1.

<?php
/* The users table consists of three fields:
*  user_id
*  username
*  password.
*/
$link = valentina_connect('localhost', 'val_user', 'val_password');
if (!$link) {
   die('Could not connect to Valentina server: ' . val_error());
}
$dbname = 'mydb';
$db_selected = valentina_select_db($dbname, $link);
if (!$db_selected) {
   die("Could not set $dbname: " . valentina_error());
}
$res = valentina_query('select * from users', $link);
 
echo valentina_field_name($res, 0) . "\n";
echo valentina_field_name($res, 2);
?> 

The above example will output:

user_id
password

Notes

Note: Field names returned by this function are case-sensitive.

Note: For downward compatibility, the following deprecated alias may be used: valentina_fieldname()