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 and mysql_num_fields()? Maybe there is a way with one mysql query?
SELECT COUNT(*) totalColumns
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'table1' AND
TABLE_SCHEMA = 'databaseName'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With