(16) int mysql_field_seek (int result, int field_offset );
Set indexes for subsequent mysql_fetch_field () calls. The next call to publish mysql_fetch_field () without specifying the column number will return the information of column col_num. If the search is successful, true is returned. Otherwise, false is returned.
The range of col_num is 0 to mysql_num_fields ()-1.
<? Php
$ Link = mysql_pconnect ("localhost", "sunsoft", "suixiang ")
Or die ("cocould not connect ");
Mysql_select_db ("stamp_db") or die ("cocould not select database ");
$ Query = "SELECT * FROM president ";
$ Result = mysql_query ($ query) or die ("Query failed ");
For ($ I = 0; $ I <mysql_num_fields ($ result); $ I ++)
{
Printf ("Information for column % d: <BR>
", $ I );
If (! Mysql_field_seek ($ result, $ I ))
{
Print ("Cannot seek to colum <BR>
");
Continue;
}
$ Meta = mysql_fetch_field ($ result, $ I );
If (! $ Meta)
{
Print ("No information available <BR>
");
Continue;
}
Print ("<PRE>
");
Printf ("blob: % s
", $ Meta-> blob );
Printf ("max_length: % s
", $ Meta-> max_length );
Printf ("multiple_key: % s
", $ Meta-> multiple_key );
Printf ("name: % s
", $ Meta-> name );
Printf ("not_null: % s
", $ Meta-> not_null );
Printf ("numeric: % s
", $ Meta-> numeric );
Printf ("primary_key: % s
", $ Meta-> primary_key );
Printf ("table: % s
", $ Meta-> table );
Printf ("type: % s
", $ Meta-> type );
Printf ("unique_key: % s
", $ Meta-> unique_key );
Printf ("unsigned: % s
", $ Meta-> unsigned );
Printf ("zerofill: % s
", $ Meta-> zerofill );
Print ("</PRE>
");
}
?>
(17) string mysql_field_table (int result_id, int col_num );
Returns the table name of the given column in The result set. This name is null for the calculated column.
The range of col_num is 0 to mysql_num_fields ()-1.
<? Php
$ Link = mysql_pconnect ("localhost", "sunsoft", "suixiang ")
Or die ("cocould not connect ");
Mysql_select_db ("stamp_db ");
$ Query = "SELECT * FROM president ";
$ Result = mysql_query ($ query) or die ("Query failed ");
For ($ I = 0; $ I <mysql_num_fields ($ result); $ I ++)
{
Print ("column $ d:", $ I );
Printf ("Name % s
", Mysql_field_name ($ result, $ I ));
Printf ("Table % s
", Mysql_field_nmae ($ result, $ I ));
Print "<BR>
";
?>
(18) string mysql_field_type (int result_id, int col_num );
Type name of the given column in the returned result set. For more information about the type name, see "MySQL column type reference ".
The range of col_num is 0 to mysql_num_fields ()-1.
<? Php
$ Link = pconnect ("localhost", "sunsoft", "suixiang ")
Or die ("cocould not connect ");
Mysql_select_db ("stamp_db ");
$ Query = "SELECT * FROM president ";
$ Result = mysql_query ($ query) or die ("Query failed ");
For ($ I = 0; $ I <mysql_num_fields ($ result); $ I ++)
{
Printf ("colum % d:", $ I );
Printf ("Name % s,
", Mysql_field_name ($ result, $ I ));
Printf ("Type % s
", Mysql_field_type ($ result, $ I ));
}
?>
(19) string mysql_field_flags (int result_id, int col_num );
Returns the metadata of the given column in The result set as a string. If an error occurs, false is returned. This string is composed of words separated by spaces, indicating which column is marked as true. For false tags, the corresponding words are given in the string.
The range of col_num is 0 to mysql_num_fields ()-1.
<? Php
$ Link = mysql_pconnect ("localhost", "sunsoft", "suixiang ")
Or die ("cocould not connect ");
Mysql_select_db ("stamp_db ");
$ Query = "SELECT * FORM member ";
$ Result = mysql_query ($ query) or die ("Query failed ");
For ($ I = 0; $ I <mysql_num_fields ($ result); $ I ++)
{
Printf ("column % d:", $ I );
Printf ("Name % s,
", Mysql_fields_name ($ result, $ I ));
Printf ("Flags % s
", Mysql_fields_flags ($ result, $ I ));
}
?>
(20) int mysql_field_len (int result, int field_offset );
Returns the maximum possible length of a given column in The result set.
The range of col_num is 0 to mysql_num_fields ()-1.
<? Php
$ Link = mysql_pconnect ("localhost", "sunsoft", "suixiang ")
Or die ("cocould not connect ");
Mysql_select_db ("stamp_db ");
$ Query = "SELECT * FROM member ";
$ Result = mysql_query ($ query) or die ("Query failed ");
For ($ I = 0; $ I <mysql_num_fields ($ result); $ I ++)
{
Printf ("Column % d:", $ I );
Printf ("Name % s,
", Mysql_field_name ($ result, $ I ));
Printf ("Len % d
", Mysql_field_len ($ result, $ I ));
Print "<BR>
";
}
?>