MySQL数据库函数详解

来源:互联网 发布:unity3d 皮影人 编辑:程序博客网 时间:2024/05/20 06:50
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

(17) string MySQL_field_table(int result_id, int col_num);
返回结果集给定列的表名。对于计算列,此名为空。
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 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);
返回结果集给定列的类型名。类型名敬请等待参考本人的另外“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);
作为字符串返回结果集中给定列的相关元数据信息,如果出现错误,则返回假。这个字符串由以空格分开的词

组成,说明哪个列的标记值为真。对于假的标记,在字符串中给出相应的词。
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);
返回结果集给定列中值可能的最大长度。
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>
";
}
?>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击