Страница процесса PHP wampserver


0

Проверьте **** Измененную линию **** ниже. Используйте fetch_assoc вместо mysqli_fetch_assoc

/*
* Get total questions
*/
$query = "SELECT * FROM questions";

//Get result 
$results = $mysqli->query($query);
$total = $results->num_rows;

/*
* Get correct option
*/
$query = 'SELECT * FROM options WHERE WHERE question_no = $number AND is_correct = 1';
// Get result
$result = $mysqli->query($query);

// Get row

$row = $result->mysqli_fetch_assoc(); // ****Changed Line****

//Set correct choice

$correct_choice = $row['id'];

//Compare
if ($correct_choice == $selected_choice) {
    //Answer is correct
    $_SESSION['score']++;
PHP, MySQLi,

php,mysqli,

-1

Ответов: 1


0

Проверьте **** Измененную линию **** ниже. Используйте fetch_assoc вместо mysqli_fetch_assoc

/*
* Get total questions
*/
$query = "SELECT * FROM questions";

//Get result 
$results = $mysqli->query($query);
$total = $results->num_rows;

/*
* Get correct option
*/
$query = 'SELECT * FROM options WHERE WHERE question_no = $number AND is_correct = 1';
// Get result
$result = $mysqli->query($query);

// Get row

$row = $result->mysqli_fetch_assoc(); // ****Changed Line****

//Set correct choice

$correct_choice = $row['id'];

//Compare
if ($correct_choice == $selected_choice) {
    //Answer is correct
    $_SESSION['score']++;
PHP, MySQLi,
Похожие вопросы
Яндекс.Метрика