MySQL数据库函数详解(4)
2007-11-11 13:45:32 来源:WEB开发网核心提示:(16) int MySQL(和PHP搭配之最佳组合)_field_seek(int result, int field_offset); 为随后的MySQL(和PHP搭配之最佳组合)_fetch_field()调用设置索引,发布没有明确列号的MySQL(和PHP搭配之最佳组合)_fetch_field()的下一次调用
(16) int MySQL(和PHP搭配之最佳组合)_field_seek(int result, int field_offset);
为随后的MySQL(和PHP搭配之最佳组合)_fetch_field()调用设置索引。发布没有明确列号的MySQL(和PHP搭配之最佳组合)_fetch_field()的下一次调用,将返回列col_num的信息。如果搜索成功,返回真,否则返回假。
col_num的范围为0到MySQL(和PHP搭配之最佳组合)_num_fields()-1.
<?php
$link=MySQL(和PHP搭配之最佳组合)_pconnect("localhost","sunsoft","suixiang")
or die("Could not connect");
MySQL(和PHP搭配之最佳组合)_select_db("stamp_db") or die("Could not select database");
$query="SELECT * FROM president";
$result=MySQL(和PHP搭配之最佳组合)_query($query) or die("Query failed");
for($i=0;$i<MySQL(和PHP搭配之最佳组合)_num_fields($result);$i++)
{
printf("Information for column %d:<BR>
",$i);
if(!MySQL(和PHP搭配之最佳组合)_field_seek($result,$i))
{
print("Cannot seek to colum<BR>
");
continue;
}
$meta=MySQL(和PHP搭配之最佳组合)_fetch_field($result,$i);
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("Prima(最完善的虚拟主机管理系统)ry_key: %s
",$meta->Prima(最完善的虚拟主机管理系统)ry_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>
");
}
?>
为随后的MySQL(和PHP搭配之最佳组合)_fetch_field()调用设置索引。发布没有明确列号的MySQL(和PHP搭配之最佳组合)_fetch_field()的下一次调用,将返回列col_num的信息。如果搜索成功,返回真,否则返回假。
col_num的范围为0到MySQL(和PHP搭配之最佳组合)_num_fields()-1.
<?php
$link=MySQL(和PHP搭配之最佳组合)_pconnect("localhost","sunsoft","suixiang")
or die("Could not connect");
MySQL(和PHP搭配之最佳组合)_select_db("stamp_db") or die("Could not select database");
$query="SELECT * FROM president";
$result=MySQL(和PHP搭配之最佳组合)_query($query) or die("Query failed");
for($i=0;$i<MySQL(和PHP搭配之最佳组合)_num_fields($result);$i++)
{
printf("Information for column %d:<BR>
",$i);
if(!MySQL(和PHP搭配之最佳组合)_field_seek($result,$i))
{
print("Cannot seek to colum<BR>
");
continue;
}
$meta=MySQL(和PHP搭配之最佳组合)_fetch_field($result,$i);
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("Prima(最完善的虚拟主机管理系统)ry_key: %s
",$meta->Prima(最完善的虚拟主机管理系统)ry_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>
");
}
?>
更多精彩
赞助商链接