PHP查询MYSQL表的主键
Posted ylong52
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP查询MYSQL表的主键相关的知识,希望对你有一定的参考价值。
$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 />"; }
关键字段:
echo "Primary Key: " . $property->primary_key . "<br />";
以上是关于PHP查询MYSQL表的主键的主要内容,如果未能解决你的问题,请参考以下文章