分类: Mysql/postgreSQL
2008-05-14 23:37:26
来源: |
|
(17) string mysql_field_table(int result_id, int col_num); 返回结果集给定列的表名。对于计算列,此名为空。 col_num的为0到mysql_num_fields()-1. $link=mysql_pconnect("localhost","sunsoft","suixiang") or die("Could 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); 返回结果集给定列的类型名。类型名敬请等待本人的另外“MySQL列类型参考”。 col_num的范围为0到mysql_num_fields()-1. $link=pconnect("localhost","sunsoft","suixiang") or die("Could 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); 作为字符串返回结果集中给定列的相关元数据,如果出现错误,则返回假。这个字符串由以空格分开的词 组成,说明哪个列的标记值为真。对于假的标记,在字符串中给出相应的词。 col_num的范围为0到mysql_num_fields()-1. $link=mysql_pconnect("localhost","sunsoft","suixiang") or die("Could 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); 返回结果集给定列中值可能的最大长度。 col_num的范围为0到mysql_num_fields()-1. $link=mysql_pconnect("localhost","sunsoft","suixiang") or die("Could 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" "; } ?> |