MySQL查询获取列名?我想把MySQL表的所有名称都放到php中的数组中吗?这里有查询吗?
3 回答
桃花长相依
TA贡献1860条经验 获得超8个赞
SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='yourdatabasename' AND `TABLE_NAME`='yourtablename';
SHOW ...
SHOW...
INFORMATION_SCHEMA
INFORMATION_SCHEMA
交互式爱情
TA贡献1712条经验 获得超3个赞
SHOW columns FROM your-table;
$sql = "SHOW COLUMNS FROM your-table";$result = mysqli_query($conn,$sql);while($row = mysqli_fetch_array($result)){ echo $row['Field']."<br>";}
SHOW COLUMNS FROM TABLE
添加回答
举报
0/150
提交
取消