Results 1 to 5 of 5
Apr 1, 2012, 00:02 #1
- Join Date
- Aug 2010
- 2 Post(s)
- 0 Thread(s)
Prepared Statement to place Multiple Rows into Variables
In my User Profiles, I have 10 Questions that Members may answer.
I have decided to model this as a many-to-many relationship where "answer" is the intermediary table between "member" and "question".
For each Member Profile, I need to display the responses to each Question in their Profile, but if I run a query like this...
SELECT response FROM answer WHERE member_id = 1;
01 I started my own business because...
02 My advice to other entrepreneurs is to get a good lawyer!
10 I compete with large corporation by knowing my customers and giving exceptional service!
What I need - if possible - is to write a Prepared Statement that would take the 10 records returned - with just one Field - and store each respective record into a variable like $response1, $response2,... $response10 so that ONE QUERY can be used to populate my 10 Text Boxes on the "my_thoughts.php" page in their Profile.
(If I have to write 10 separate Prepared Statements - one for each Question - I will scream!!!)
Can this be done?
If so, how would I do it?
(I'm still not that strong with Prepared Statement, especially fancier things like this...)