The problem i'm having is from the 4th line of code listed below. I get an error that says
Warning:
mysqli_fetch_array()
expects parameter 1 to bemysqli_result
,string
given
I don't have the variable enclosed in " "
or ' '
so I'm not sure where the string recognition is coming from at this point. Can tell me how to fix this error?
$query = "SELECT * FROM questions WHERE id='question' LIMIT 5"; $result = mysqli_query($connection, $query); if($query === FALSE) { die(mysql_error()); } while($row = mysqli_fetch_array($query)){ $id = $row['id']; $thisQuestion = $row['question']; $question_id = $row['question_id']; $q = '<h2>'.$thisQuestion.'</h2>'; $query2 = "SELECT * FROM answers WHERE question_id='$question' ORDER BY rand() LIMIT 5"; while($row2 = mysqli_fetch_array($query2)){ //... } }