站长学堂
你的位置: 中国个人站长站 -- 站长学堂 -- 数据库 -- MySQL教程 -- 文章正文 MySQL数据库函数详解(3)
推荐位

MySQL数据库函数详解(3)

中国个人站长站 MySQL教程 点击数: 更新时间:2005-3-12 9:19:17
lect 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);
$meta=mysql_fetch_field($result);
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>
");
}
?>

(12) array mysql_fetch_lengths(int result);
本函式将 mysql_fetch_row() 处理过的最后一列资料的各栏位资料最大长度放在阵列变数之中。若执行失败则传回 false 值。传回阵列的第一笔资料索引值是 0。

<?php
$link=mysql_pconnect("localhost","sunsoft","suixiang") or die("Could not connect");
mysql_select_db("stamp_db") or die("Could not select database");
$query="SELECT * FROM president" or die("Query failed");
$row_num=0;
while(mysql_fetch_row($result))
{
++$row_num;
printf("Lengths of values in row %d:<BR>
",$row_num);
$len=mysql_fetch_lengths($result);
if(!$len)
{
print("No information available<BR&g

上一页  [1] [2] [3] 下一页

SQL爱好者 网友投稿 文章录入:swh    责任编辑:swh 
个人站长站与你风雨同舟!
本站所提供的资源均来源于互联网,如有侵权行为,请与本站管理员联系,我们会第一时间删除!
·如果您发现《MySQL数据库函数详解(3)》文章有错误,也请通知我们修改!
联系邮箱chinageren#126.com,谢谢支持!
站内搜索:
广告服务 | 友情链接 | 联系我们 | 免责声明 | 用户留言 | 网站导航
版权所有:中国个人站长站 2007-2008 未经授权禁止复制或建立镜像 客服QQ号:112731235
copyright © 2007-2008 www.ChinaGeRen.com online services. all rights reserved. 苏ICP备05000059号