For a beginner, they must learn in the course of learning the flexible use of various
The Mysql_field_type () function obtains the data type of the field, and the syntax of the function is as follows.
String Mysql_field_type (resource $result, int $field _offset)
The Mysql_field_type () function is similar to the function mysql_field_name (), but the Mysql_field_type () function returns the data type of the field. The description of its parameters is as follows.
L Result:mysql_query () The result set returned after the function is executed.
L Field_offset: The offset of the field with a starting value of zero.
The sample code for using the Mysql_field_type () function is as follows:
Code 23-12 CD Codes 23rd Chapter 23.3mysql_field_type.php
- < ? 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_field_type ($result, 0);
- Data type of the first field
- echo " < br>";
- Echo Mysql_field_type ($result, 1);
- Data type of the second field
- echo " < br>";
- Echo Mysql_field_type ($result, 2);
- Data type of the third field
- Mysql_free_result ($result);
- Mysql_close ();
- ?>
The data type of the first 3 fields in the table employee will be output when the above code executes.
http://www.bkjia.com/PHPjc/445931.html www.bkjia.com true http://www.bkjia.com/PHPjc/445931.html techarticle for a beginner, they must learn the flexible use of various mysql_field_type () functions to obtain the data type of the field, the syntax of the function is as follows. ...