MySQL database function details (5) _ MySQL

Source: Internet
Author: User
MySQL database function details (5) (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.

$ 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 {
Print ("column $ d:", $ I );
Printf ("Name % s
", Mysql_field_name ($ result, $ I ));
Printf ("Table % s
", Mysql_field_nmae ($ result, $ I ));
Print"

";
?>

(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.

$ 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 {
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 separated by spaces.

Indicates the column whose tag value is true. For false tags, the corresponding words are given in the string.
The range of col_num is 0 to mysql_num_fields ()-1.

$ 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 {
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.

$ 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 {
Printf ("Column % d:", $ I );
Printf ("Name % s,
", Mysql_field_name ($ result, $ I ));
Printf ("Len % d
", Mysql_field_len ($ result, $ I ));
Print"

";
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.