cubrid_field_type

(PECL CUBRID >= 8.3.0)

cubrid_field_typeReturns the type of the column corresponding to the given field offset

Description

string cubrid_field_type ( resource $req_identifier , int $field_offset )

This function returns the type of the column corresponding to the given field offset. The returned field type could be one of the following: "int", "real", "string", etc.

Parameters

req_identifier

This is the requeset identifier.

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.

Return Values

Type of the column, on success.

FALSE when invalid field_offset value.

-1 if SQL sentence is not SELECT.

Examples

Example #1 cubrid_field_type() example

<?php
    $link 
cubrid_connect("localhost"30000"demodb2""dba""");
    if (!
$link)
    {
        die(
'Could not connect.');
    }
    
$query 'SELECT id, name, address, salary FROM employees';
    
$result cubrid_execute($link$query);
    if (
$result
    {
        echo 
"Field 0 (<b>"cubrid_field_name($result0) . "</b>) has type <i>" cubrid_field_type($result0) . "</i><br>";
        echo 
"Field 1 (<b>"cubrid_field_name($result1) . "</b>) has type <i>" cubrid_field_type($result1) . "</i><br>";
        
        
cubrid_close_request($result); 
    }
?>

The above example will output:

Result:
Field 0 (id) has type INT
Field 1 (name) has type STRING

Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout