Return array of rows in MySQL and PHP -


got following tables:

forms - id - name  questions - id - form_id - type - name  questions_translations - id - question_id - lang_id - label - placeholder  poss_answers - id - question_id - lang_id  poss_answers_translations - id - poss_answer_id - value 

now want select questions , possible answers 1 form, 1 language. can select elements without using poss_answers_table:

select b.*, f.* app_questions q join app_questions_translations qt  on q.form_id = 4 lang_id = 4 && qt.question_id = q.id 

this gets me elements 2 tables, want add in poss_answers table. table holds possible answers select field, or checkbox field, or radio field. these answers can choosen from.

but how can within 1 query?

presuming 1 question (row) has many answers (rows), joining answer table give question details returned every answer row. not ideal.
need 'getanswers' query, inside 'getquestions' query, return answers particular question.

something this..

//'getquestions' foreach($questions $question)..      echo $question;      //'getanswers - question;     foreach($answers $answer)..          echo $answer;      //endanswerloop  //endquestionloop 

Comments