currently I have a client that would like to display his queries in Excel, this ofcourse is not a problem. However getting the data in the correct format is becoming quite a problem. My client has a list of companies, each of these companies has a dynamic form(form values are stored in mySQL) as are the answers to forms. I will try to detail the best I can, what it is I am needing below:
company table
-------------
compID compName
------ --------
1 Joe-Mart
2 Bob-Liquors
Form table (questions)
----------
formID compID question
------ ------ --------
1 1 Your First name
2 1 Your Last name
Answer table
------------
answerID formID answer
-------- ------ ------
1 1 Bill
2 2 Johnson
Ok, so the data looks something like that, my client is currently wanting the report to look like such:
--------------------------------
|Your First Name|Your Last Name|
--------------------------------
| Bill | Johnson |
--------------------------------
| Tom | Jones |
--------------------------------
| George | Jackson |
--------------------------------
The problem is I have no idea how to make dynamic headers in MySQL.... I mean I am able to pull a list of questions, a list of answers...but I have no idea you to construct a query that would spit out something like displayed above.
** I am afraid due to the nature of my clients site I will be unable to provide access to the direct data, however I will be able to set up a mock table structure that is a little better than the one above for you to use.