(PECL CUBRID >= 8.3.0)
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 request identifier.
Number of columns, on success.
-1 if SQL sentence is not SELECT.
Beispiel #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);
}
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
Result: The resultset contains 4 fields: id name address salary