Jump to content

PHP mySQL Quiz


Recommended Posts

Using Dreamweaver, php, mySQL

 

I have to make a quiz, with just 1 question and 1 answer.

 

Firstly I've created the database

Name: questionaire

Table: checkfyp

Fields: Question and Answer

 

The form only consist a question, and a textbox.

 

Connection from dreamweaver to mySQL is currently working. I could insert , delete, login and such stuffs.

 

I have no idea how to compare the user input with mySQL.

If correct -> /quiz/correct.php

else -> /quiz/incorrect.php

 

:ph34r: I'm a newbie in php..please help..

 

Link to comment
https://forums.phpfreaks.com/topic/1757-php-mysql-quiz/
Share on other sites


<?php

// Connect to database


Put your database connect stuff here



// Quiz checking

$query = "SELECT * FROM checkfyp";
$result = mysql_query($query) or die(mysql_error());
while($r = mysql_fetch_array($result))
{

if($r[Question] == $user_submitted_Question)
{

Make page re-direction here to correct.php;

} else {


incorrect.php

}

}

?>

 

 

Hope you can understand this :(

Link to comment
https://forums.phpfreaks.com/topic/1757-php-mysql-quiz/#findComment-5727
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.