发布网友 发布时间:2022-04-09 02:55
共4个回答
懂视网 时间:2022-04-09 07:17
$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表的主键
标签:
热心网友 时间:2022-04-09 04:25
在phpmyadmin中热心网友 时间:2022-04-09 05:43
把主键的额外值设为auto_increment,写语句时留个空格就好了,程序会自动加1的。热心网友 时间:2022-04-09 07:17
主键最好用自动增长的!!!