So I decided I wanted to make something similar yet slightly more complicated and I'm not sure if I'm on the right track. Basically it's a "flash card" game where:
- The user gets to input their own questions and answers into a simple form, which would then go into an MySQL table with 2 columns, questions and answers
- A new page where the user see's random question, must input an answer, if the answer matches goes to next question otherwise gives error
Now I'm confused as to how to go about making this. I was thinking of making some session variables and then do something along the lines of
Code: Select all
$display_query = "SELECT * FROM questions";
$display = mysqli_query($connection, $display_query);
while ($row = mysqli_fetch_array($display)) {
$_SESSION['question'] = $row[0];
}Code: Select all
if ($_SESSION['answer'] != $row[1]) {
echo "error, try again"
} else {
// I would write something here to grab the next question
}
So am I just completely off the wall with this, how would I make such an app? How would I make it, for example, fetch new questions?