For the code below, $result will return 4 rows from my question_answers table which have the corresponding question_id.
At the moment I am fetching all 4 rows into the $answers variable. I was wondering how I could separate each row from the result and store them as separate variables so I could, say, printf them one at a time.
Thanks.
Edit: also, since the question_id column is an integer in the question_answers table and also in $question["question_id"], have I written my WHERE statement correctly? Thanks.
$result = mysqli_query($connection, 'SELECT FROM questions_answers WHERE question_id='".$question["question_id"]."' ORDER BY RAND()'); //Runs the select query to get the possible answers to the randomly selected question
if(mysqli_num_rows($result)>0){
$answers = mysqli_fetch_assoc($result);
//printf each row individually
}
else{
printf("ERROR: no answers for this question exist!");
}