$number = (int) $_GET['n'];
$query = "SELECT * FROM `questions`
WHERE question_number = $number";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$question = $result->fetch_assoc();
If I do a var dump on $question, I get NULL output to the screen. If I do
then it works. I see the question.
why can't I use a foreach loop on the question variable? I am guessing foreach loops don't work well on associative arrays?
my working loop
the results here
1. Why would question be null in a var_dump or a print_r?
2. Can you explain why the foreach loop fails but a while loop works?