Hello Reader's, If you have to get the only names of columns of table then see the code below:-
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 user"; //here user is my table
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)){
echo $row['Field']."<br>";
}
0 Comment(s)