0

I have a problem, and I can't really figure out what to do after reading documentation. Right now i'm making a quizz app for fun. Heres my PHP code. The error lies in $question. Which I want to be an associative array of the actual query itself. I'm wondering how I can achieve what I want, because I feel like i've done something similar in the past but I just can't remember how

<?php include 'database.php'; ?>'
<?php

    // Set question number
    $number = (int) $_GET['n'];

    $query = "SELECT * FROM 'questions'";
    $query.= "WHERE question_number = $number";
    $result = mysqli_query($connection,$query);
    $question = mysqli_fetch_assoc($result);


?>
chris85
  • 23,846
  • 7
  • 34
  • 51
Muntasir Alam
  • 1,777
  • 2
  • 17
  • 26

1 Answers1

0

Don't use quotes for table names in MySQL. Use nothing or backtricks:

$query = "SELECT * FROM questions";
// or
$query = "SELECT * FROM `questions`";
Henrique Barcelos
  • 7,670
  • 1
  • 41
  • 66