Home >Backend Development >PHP Tutorial >PHP mysql_field_type() function_PHP tutorial
Definition and usage
mysql tutorial_field_type() function returns the type of the specified field in the result set.
If successful, return the type of the specified field, if failed, return false.
Grammar
mysql_field_type(data,field_offset) parameter description
data required. The data pointer to use. The data pointer is the result returned from mysql_query().
field_offset required. Indicates which field to start returning from. 0 indicates the first field.
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$query = "SELECT id as ID, title FROM mytable ORDER BY title";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo mysql_field_type($result, 0);
?>