Now let's take a look at the mysql_fetch_field () function. This function reads the instance name and field name of the mysql data table. Let's take a look at its syntax.
Mysql_fetch_field (data, field_offset)
Mysql_fetch_field ()For example, if the record set returns the. mysql_query () function and returns the success of an object, or if it is FALSE or fails
It has two parameters:. data and field_offset.
Data: Required. The specified data pointer is used. The data pointer is generated from the mysql_query () function.
Field_offset: (optional) the record to read from. If this parameter is left blank, the code starts from 0.
Now let's look at a mysql_fetch_field instance.
<?
$ SQL = "SELECT * from ";
$ Result = mysql_query ($ SQL, $ con );
While ($ property = mysql_fetch_field ($ result) {echo "Field name:". $ property-> name. "<br/> ";}
The output result is the name of all fields in your data table.