mysql_num_fields

(PHP 4, PHP 5)

mysql_num_fieldsGet number of fields in result

Avviso

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:

Descrizione

mysql_num_fields(resource $result): int|false

Retrieves the number of fields from a query.

Elenco dei parametri

result

The risultato resource che che viene calcolato. Questo risultato deriva dal una chiamata a mysql_query().

Valori restituiti

Returns the number of fields in the result set resource on success o false in caso di fallimento.

Esempi

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);
?>

Note

Nota:

Per la compatibilità all'indietro, i seguenti sinonimi (deprecati) possono essere utilizzati: mysql_numfields()

Vedere anche:

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top