Counting the number of columns, or fields, in a MySQL table is a fairly simple, though not exactly obvious task. You will need to know both the name of the table to query on, as well as the database. The query is as follows, plug in your values for database_name and table_name
WHERE table_schema = 'database_name'
AND table_name = 'tbl_name'