MHaris
08-17-2007, 08:49 PM
I have a table called answers.
The structure of the table is:
id
candidate_id
question_id
answer
I want to create an array based on candidate_id answer and in question_id order.
For example,
Answer of question(question_id) 1 is 1(answer) answered by candidate(candidate_id) 2
Answer of question_id 2 is 2 answered by candidate_id 2
Answer of question_id 3 is 1 answered by candidate_id 2
Answer of question_id 1 is 1 answered by candidate_id 2
Answer of question_id 1 is 2 answered by candidate_id 2
So the array would be
$array = array(
'candidate_2' => array(1,2,1,1,2);
)
I have around 15 candidates and 15 questions.
The structure of the table is:
id
candidate_id
question_id
answer
I want to create an array based on candidate_id answer and in question_id order.
For example,
Answer of question(question_id) 1 is 1(answer) answered by candidate(candidate_id) 2
Answer of question_id 2 is 2 answered by candidate_id 2
Answer of question_id 3 is 1 answered by candidate_id 2
Answer of question_id 1 is 1 answered by candidate_id 2
Answer of question_id 1 is 2 answered by candidate_id 2
So the array would be
$array = array(
'candidate_2' => array(1,2,1,1,2);
)
I have around 15 candidates and 15 questions.