Please excuse me. That's actually what I thought I sent you in my last reply:
SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA='emily' AND TABLE_NAME='catkey'
You see, once I discovered (with your help) that I could use code such as:
My inclination would have been to do a query then a mysql_fetch_array.
However, your code reminds me that a lot more can be done in the query so I'm working to completely understand it.
Consequently, I need to ask about your code incrementally.
SELECT cu.ordinal_position, cu.column_name
tells me that somewhere in the available info is a key called ordinal_position and one called column_name and they will be SELECTed from an alias called cu. Right?