We pass on
The Mysql_num_fields () function can count the number of all fields in the table that will be queried, and the syntax of the function is as follows:
int Mysql_num_fields (Resource $result)
Where the parameter result is the result set returned after the mysql_query () function executes. The sample code for getting the number of fields in PHP using the Mysql_num_fields () function is as follows:
- < ? PHP
- $ Connection = mysql_connect ("localhost",
"Root", "root") or Die ("Connection Server failed");
- mysql_select_db ("Sunyang", $connection)
Or Die ("Select Database Failed");
- $ Query = "SELECT * FROM Employee" ;
- $ result = mysql_query ($query) or
Die ("Query data Failed"); Execute Query
- echo Mysql_num_fields ($result);
Number of output fields
- Mysql_free_result ($result);
- Mysql_close ();
- ?>
The above is an introduction to the implementation of the number of PHP get fields.
http://www.bkjia.com/PHPjc/445926.html www.bkjia.com true http://www.bkjia.com/PHPjc/445926.html techarticle we can count the number of all fields in the table to be queried by the Mysql_num_fields () function, which is syntactically formatted as follows: Int Mysql_num_fields (Resource $result) its ...