(PHP 4, PHP 5)
mysql_num_fields — Get number of fields in result
Retrieves the number of fields from a query.
Резултатният ресурс, който бива оценен. Този резултат идва от извикване на mysql_query().
Returns the number of fields in the result set resource on success, or FALSE on failure.
Example #1 A mysql_num_fields() example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
/* returns 2 because id,email === two fields */
echo mysql_num_fields($result);
?>
Забележка: От съображения за обратна съвместимост, може да бъде използван следният непрепоръчителен псевдоним: mysql_numfields()