Page 1 of 1

select columns

Posted: Tue Jun 06, 2006 2:14 pm
by Luke
How would you select all the columns from a certain table? I tried "SELECT COLUMNS AS something() FROM table" and "SHOW COLUMNS FROM table" and neither worked!

How do I get all columns from the table in an array?

Posted: Tue Jun 06, 2006 2:21 pm
by feyd

Code: Select all

DESCRIBE `table`

Posted: Wed Jun 07, 2006 6:48 am
by GM
You can also do a select from the information_schema database (assuming mysql):

Code: Select all

SELECT column_name FROM COLUMNS WHERE table_schema='database_name' and table_name='table_name'