Paul Paul - 1 year ago 90
PHP Question

Get number of fields in mysql table

How can I get number of fields(—Āolumns) in mysql table with PHP or just some kind of mysql query? Is there a way to do this without

SELECT * FROM table_name
? Maybe there is a way with one mysql query?

Answer Source
SELECT COUNT(*) totalColumns
WHERE  table_name = 'table1' AND 
       TABLE_SCHEMA = 'databaseName'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download