PHP mysql_field_type() Function
Definition and Usage
The mysql_field_type() function returns the type of the specified field in the result set.
If successful, it returns the type of the specified field, and if it fails, it returns false.
Syntax
mysql_field_type(data,field_offset)
Parameter | Description |
---|---|
data | Required. The data pointer to be used. The data pointer is from mysql_query() The result returned. |
field_offset | Required. Indicates from which field to start returning. 0 indicates the first field. |
Example
<?php $con = mysql_connect("localhost", "hello", "321"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db",$con); $sql = "SELECT * from Person"; $result = mysql_query($sql,$con); $type = mysql_field_type($result, 0); echo $type; mysql_close($con); ?>
Output:
string