jeudi 7 juillet 2016
$_GET , undefined index n
Currently making a Quiz application and I'm almost done. Having ap roblem with my question page though which is reading from my database.
In my index.php file I have a link to start the quiz here
<a href = "questions.php?n=1" class = "start"> Start Quiz </a>
I've also connected to my database in a file called database.php. Here is my questions.php page, and I'm trying to set $number equal to the n=1 portion of the link I set in index.php. I'm sure i've done something exactly like this in the past. Any help?
<?php include "database.php"; ?>
<?php session_start(); ?>
<?php
$number = (int) $_GET['n'];
$query = "SELECT * FROM questions";
$query.= " WHERE question_number = $number";
$result = mysqli_query($connection,$query);
$question = mysqli_fetch_assoc($result);
?>
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire