im trying to get the column names based on the query I send in to PDO. Unfortunately I do not know anything except the query at this moment. I know that I can get the associated array from the statement but what if the table is empty? I still need the column names at least to show an empty result in the table.
MENTION: This is a SQLite DB.
Let's say I have this query:
select 1+1 as 'addition', id, column1, column2 from table
If I try to get the columns from table by reading the table information from the DB it will show
id:int, column1:text, column2:text
and leave out my "addition" column. This is misleading for me and would not result in a correct data array.
Any suggestions how to get all the column names based on the query?
Best regards,
GT