(PHP 4, PHP 5)
mysql_num_fields — Get number of fields in result
Questa enstensione deprecata da PHP 5.5.0, e sarà rimossa in futuro. Al suo posto, usare l'estensione MySQLi o PDO_MySQL. Vedere anche la guida MySQL: scelta dell'API e le FAQ relative per ulteriori informazioni. Le alternative a questa funzione includono:
Retrieves the number of fields from a query.
result
The risultato resource che che viene calcolato. Questo risultato deriva dal una chiamata a mysql_query().
Returns the number of fields in the result set resource on
success o false
in caso di fallimento.
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);
?>
Nota:
Per la compatibilità all'indietro, i seguenti sinonimi (deprecati) possono essere utilizzati: mysql_numfields()