Skip to main content
2 of 2
added 2 characters in body
Alex L
  • 5.8k
  • 2
  • 26
  • 69

With PDO, you could have:

$getStuff = $pdo->prepare('SELECT `question`, `answer` FROM `Quizzes` WHERE `questionNumber`< :questionNumber ORDER BY `questionNumber` ASC');

$getStuff->execute(array('questionNumber' => 21));

$rows = $getStuff->fetchAll();

foreach($rows as $row)
{
   $questions[] = $row['question'];
   $answers[]   = $row['answer'];
}

It's up to you to decide if removing the binding stuff makes the code any easier to read and maintain.

Cerad
  • 291
  • 1
  • 3