Home >Backend Development >PHP Tutorial >PHP mysql_field_flags() example tutorial_PHP tutorial
Definition and usage
The mysql_field_flags() function returns the flags of the field record.
This function gets the field data using the mysql_query() function and returns a string on success, or FALSE or on failure when there are no more rows.
Possible return values:
auto_intcrement -1 if set A UTO_INCREMENT
Binary -1 if the field has Binar attribute set
Spot -1 if it is a foreign B LOB
enum -1 if field is an enum field
multiple_key -1 if field is a non-unique key
not_null -1 if the field cannot be null
primary_key -1 if it is a foreign primary key
Timestamp -1 if field is a timestamp field
unique_key -1 if the field is a unique key
unsigned -1 if the field is unsigned
zerofill -1 if it is a foreign zero fill
Grammar
mysql_field_flags(data,field_offset)
data:. The specified data pointer is used. The data pointer is due to the field_offset requirement from the mysql_query() function. Specify which areas to start returning to. 0 indicates the first column to see an example.
$sql = "SELECT * from Person";
$result = mysql_query($sql,$con);
$flags = mysql_field_flags($result, 0);
echo $flags;
Output results.
not_null primary_key auto_increment