发布时间:2015-09-10 00:00 来源:未知
(16) int mysql_field_seek(int result, int field_offset);
为随后的mysql_fetch_field()调用设置索引。发布没有明确列号的mysql_fetch_field()的下一次调用,将返回列col_num的信息。如果搜索成功,返回真,否则返回假。
$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);
if(!mysql_field_seek($result,$i))
{
print("Cannot seek to colum<BR>
");
continue;
}
$meta=mysql_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("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>
");
}
>
(17) string mysql_field_table(int result_id, int col_num);
返回结果集给定列的表名。对于计算列,此名为空。
< php
$link=mysql_pconnect("localhost","sunsoft","suixiang")
(20) int mysql_field_len(int result, int field_offset);
返回结果集给定列中值可能的最大长度。