直播中
<?php
$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<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);
返回結(jié)果集給定列的類型名。類型名敬請(qǐng)等待參考本人的另外“MySQL列類型參考”。
col_num的范圍為0到mysql_num_fields()-1.
<?php
$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<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);
作為字符串返回結(jié)果集中給定列的相關(guān)元數(shù)據(jù)信息,如果出現(xiàn)錯(cuò)誤,則返回假。這個(gè)字符串由以空格分開的詞
組成,說明哪個(gè)列的標(biāo)記值為真。對(duì)于假的標(biāo)記,在字符串中給出相應(yīng)的詞。
col_num的范圍為0到mysql_num_fields()-1.
<?php
$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<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);
返回結(jié)果集給定列中值可能的最大長度。
col_num的范圍為0到mysql_num_fields()-1.
<?php
$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<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>
";
}
?>