I\'d like to get all of a mysql table\'s col names into an array in php?
Is there a query for this?
You can use following query for MYSQL:
SHOW columns FROM your-table;
Below is the example code which shows How to implement above syntax in php to list the names of columns:
$sql = "SHOW COLUMNS FROM your-table";
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)){
echo $row['Field']."
";
}
For Details about output of SHOW COLUMNS FROM TABLE
visit: MySQL Refrence.