localhost wampserver上的PHP错误

时间:2017-05-15 09:16:17

标签: php mysqli

如何在我的php代码上解决这个问题:

您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,以便在“问题”附近使用正确的语法WHERE question_no = 1'在第111行

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

/*
* Get question
*/
$query = "SELECT * FROM 'questions' WHERE question_no = $number";
//Get result
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);

$question = $result->fetch_assoc();

&GT;

1 个答案:

答案 0 :(得分:2)

 $number = '6'; /* * Get question */
$query = "SELECT * FROM questions WHERE question_no = $number"; 
//Get result
$result = $mysqli->query($query); 
$question = $result->fetch_assoc();


and check your database connection