Skip to content
Advertisement

PHP PDO return headers if there are no results

Is it possible to return the headers of a PDO query if there are no results as an array in PHP. For example:

JavaScript
JavaScript

Since the above will return no rows is it possible to instead return the SELECT AS so it will return:
['Type', 'Shape', 'Age', 'Name']

Advertisement

Answer

I’ve found a solution to this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement