Jump to content

Archived

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

iamnoob

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..

 

Share this post


Link to post
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 :(

Share this post


Link to post
Share on other sites

×

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.