你使用的函数就是单条的。请换成mysql_fetch_field
<?php$con = mysql_connect("localhost", "hello", "321")
if (!$con)
{
die('Could not connect: ' . mysql_error())
}
$db_selected = mysql_select_db("test_db",$con)
$sql = "SELECT * from Person"
$result = mysql_query($sql,$con)
while ($property = mysql_fetch_field($result))
{
echo "Field name: " . $property->name . "<br />"
echo "Table name: " . $property->table . "<br />"
echo "Default value: " . $property->def . "<br />"
echo "Max length: " . $property->max_length . "<br />"
echo "Not NULL: " . $property->not_null . "<br />"
echo "Primary Key: " . $property->primary_key . "<br />"
echo "Unique Key: " . $property->unique_key . "<br />"
echo "Mutliple Key: " . $property->multiple_key . "<br />"
echo "Numeric Field: " . $property->numeric . "<br />"
echo "BLOB: " . $property->blob . "<br />"
echo "Field Type: " . $property->type . "<br />"
echo "Unsigned: " . $property->unsigned . "<br />"
echo "Zero-filled: " . $property->zerofill . "<br /><br />"
}
mysql_close($con)
?>
可以用到函数select1.select1()
函数说明:
从数据集中按顺序检索到符合过滤条件的第一条记录,返回其selectExp值
语法:
datasetName.select1(selectExp{,filterExp{,rootGroupExp}})
参数说明:
selectExp
要选择的字段列名/列号,,也可以是表达式。
列号用#n表示,例如#0代表第0列,#1代表第1列,依此类推
filterExp
过滤条件
rootGroupExp
是否root数据集表达式。
返回值:
数据类型不定,由selectExp的运算结果决定
特别说明:
当对数据集运用过滤条件后确定只剩一条记录时,虽然select的运算结果一样,但是select1运算效率高,因为他只要找到符合条件的记录,就不继续检索了,而select要检索完所有的记录才返回。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)