I just thought of another way, but it would require that a result came back from your query. You could dump the first row of the result into an array using mysql_fetch_assoc and get the keys from the array using array_keys like this:
Thanks so much for your replies. They are most helpful for me (a learner) on a number of levels...First, there are several new bits of code that I have not encountered previously (e.g., ".=" -- not easy for me to grasp, but I think I've gotten to "second grade" on it now). Secondly, the overall concept, though simple to you, is new to me and I've gone through everything step-by-step.
So I'm still at work on this -- just wanted to say thanks for now.