php - Selecting table column names then display them -
i want select column names in specific table. display them.
i searched , results one.
select `column_name` `information_schema`.`columns` `table_schema`='yourdatabasename' , `table_name`='yourtablename';
if query one, how fetch them , display them ? when fetch data of table display them accourding column name.
like:
$table = mysql_query("select * table_name"); while($fetch = mysql_fetch_assoc($table)) { echo $fetch['id'] . ":" . $fetch['fullname'] . '<br>'; }
$rows = mysql_query("show columns table_name"); while($row = mysql_fetch_assoc($rows)) { echo $row['field']; }