(PHP 4, PHP 5)
cubrid_num_fields — Returns the number of columns in the result set
This function returns the number of columns in the result set, on success, or it returns FALSE on failure.
This is the result handle that is evaluated. This result is obtained by a call to cubrid_execute().
Number of columns, on success.
FALSE on failure.
Example #1 cubrid_num_fields() 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)
{
$n = cubrid_num_fields($result);
echo "The resultset contains ".$n. " fields: ";
for ($i = 0; $i < $n; $i++)
echo cubrid_field_name($result, $i)." ";
cubrid_close_request($result);
}
?>
The above example will output:
Result: The resultset contains 4 fields: id name address salary