Συνάρτηση mysql_field_flags() PHP
Ορισμός και χρήση
Η συνάρτηση mysql_field_flags() αποσπά τις σημαίες που σχετίζονται με το καθορισμένο πεδίο από το αποτέλεσμα.
Η συνάρτηση αυτή επιστρέφει τις σημαίες του πεδίου που καθορίζεται.
Εάν η έκδοση του MySQL είναι αρκετά νέα, θα υποστηρίζει τις παρακάτω σημαίες:
- auto_intcrement
- binary
- blob
- enum
- multiple_key
- not_null
- primary_key
- timestamp
- unique_key
- unsigned
- zerofill
Syntax
mysql_field_flags(data,field_offset)
Parameters | Description |
---|---|
data | Required. The data pointer to be used. The data pointer is from mysql_query() The returned result. |
field_offset | Required. Indicates from which field to return. 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