What is mysql num fields in PHP
In this article I am going to explain about mysql_num_fields function in PHP.
PHP mysql_num_fields() Function
The PHP mysql_num_fields function is used to returns number of fields in a specified table.
Syntax of mysql_num_fields function
Parameters in mysql_num_fields function
It has only one parameter:
Parameter |
Description |
data |
It specifies data pointer to use. |
Example of mysql_num_fields function
<?php
$con=mysql_connect("localhost","gupta","sharad");
if(!$con)
{
die("Could not connect:" .mysql_error());
}
mysql_select_db("Mcn_Solution",$con);
$res=mysql_query("select * from Emp");
echo "Total no of fields =". mysql_num_fields($res);
mysql_close($con);
?>
|
Output:

You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here