PHP mysql_field_flags() function
Pamamaraan at Paggamit
Ang function na mysql_field_flags() ay kumukuha ng mga tanda na nauugnay sa pinagmumulan ng field mula sa resulta.
Ang function na ito ay ibibigay ang tanda ng pinagmumulan ng field na tinukoy.
Kung sapat ang bersyon ng MySQL, magbibigay ng suporta sa mga sumusunod na tanda:
- auto_intcrement
- binary
- blob
- enum
- multiple_key
- not_null
- primary_key
- timestamp
- unique_key
- unsigned
- zerofill
Syntax
mysql_field_flags(data,field_offset)
Parameter | Description |
---|---|
data | Required. The data pointer to use. The data pointer is from mysql_query() The returned result. |
field_offset | Required. Indicates which field to start returning from. 0 indicates the first field. |
Tips and Comments
Tip:Each flag is represented by a word, separated by a space, so you can use the explode() function to split the returned string into an array.
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); $flags = mysql_field_flags($result, 0); echo $flags; mysql_close($con); ?>
Output:
not_null primary_key auto_increment