📅  最后修改于: 2022-03-11 14:56:28.198000             🧑  作者: Mango
$sqlcmd = "select * from YOURTABLE";
$result = mysqli_query($conn, $sqlcmd);
while($meta = mysqli_fetch_field($result)){
if ($meta->flags & MYSQLI_PRI_KEY_FLAG) {
//it is a primary key!
}
}
//To check if a column is primary key using php