Table of Contents
valentina_field_type()
Declaration
string valentina_field_type ( 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
The call is similar to the valentina_field_name() function. The arguments are identical, but the field type is returned instead of field name.
Return Values
The returned field type will be one of “int”, “string”, “blob”, and others as detailed in the VServer documentation.
Examples
Example 1.
<?php valentina_connect("localhost", "val_username", "val_password"); valentina_select_db("val"); $result = valentina_query("SELECT * FROM func"); $fields = valentina_num_fields($result); $rows = valentina_num_rows($result); $table = valentina_field_table($result, 0); echo "Your '" . $table . "' table has " . $fields . " fields and " . $rows . " record(s)\n"; echo "The table has the following fields:\n"; for ($i=0; $i < $fields; $i++) { $type = valentina_field_type($result, $i); $name = valentina_field_name($result, $i); $len = valentina_field_len($result, $i); $flags = valentina_field_flags($result, $i); echo $type . " " . $name . " " . $len . " " . $flags . "\n"; } valentina_free_result($result); valentina_close(); ?>
The above example will output something similar to:
Your 'func' table has 4 fields and 1 record(s) The table has the following fields: string name 64 not_null primary_key binary int ret 1 not_null string dl 128 not_null string type 9 not_null enum
Notes
Note: For downward compatibility, the following deprecated alias may be used: valentina_fieldtype()