Is there an easy way to "SELECT * FROM TABLE" , but also include the column names in the first row?
Many thanks in advance
Is there an easy way to "SELECT * FROM TABLE" , but also include the column names in the first row?
Many thanks in advance
MySQL does not deliver the column names as a row, but it certanly does deliver them.
You can set the connection type to associative (instead of indexed) to get results like 'id' => 123
instead of [0] => 123
.
Since every result set (row) contains the names as array keys, you can get them with array_keys($row) (PHP-syntax, others alike). This is the most common procedure to build e.g. CSV files.