Note that there are some explanatory texts on larger screens.

plurals
  1. POshow multiple choice questions with answers to user
    primarykey
    data
    text
    <p>i have a problem about displaying multiple choice questions to user. i have the following tables:</p> <p><strong>multiple_choice_questions</strong> (quiz_id, question,c_answer) this table have the questions with the right answers</p> <p><strong>multiple_choice_answers</strong> (answer_id, quiz_id,answer) this table have the answers with the foreign key quiz_id</p> <p><strong>multiple_choice_info</strong> (info_id,quiz_id,name,class, lesson, subject, notes,date) here are basic informations for each quiz which actually helps in choosing the appropriate quiz from the user. e.g. if a user puts as lesson mathematics it show the tests with "lesson" mathematics</p> <p>i want to display for example 10 random questions with their answers. note that each questions has plurality of different answers. e.g. question 1 have 3 different answers. question 2, 5 different answers. </p> <p>i made an effort to catch the data related with the quiz_id but this method is wrong. im new in php, mysql. </p> <pre><code>&lt;?php include('../connect_db.php'); $sql = "select * from multiple_choice_questions inner join multiple_choice_answers on (multiple_choice_questions.quiz_id = multiple_choice_answers.quiz_id) inner join multiple_choice_info on (multiple_choice_questions.quiz_id = multiple_choice_info.quiz_id)"; $myData3 = mysql_query($sql); while($row = mysql_fetch_array($myData3)) { echo '&lt;input type="text" value="'.$row['question'].'" name="q'.$row['quiz_id'].'"/&gt;&lt;br&gt;'; echo '&lt;input type="radio" value="'.$row['answer'].'" name="q'.$row['answer'].'"/&gt;"'.$row['answer'].'"'; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload