2 Replies - 625 Views - Last Post: 24 June 2011 - 08:31 AM

#1 puyunk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 27-April 11

How to send and load questions from database?

Posted 22 June 2011 - 10:43 PM

Hi there again... :D

Do anybody know how any tutorial to send questions data to database and load them back?
I have managed to open the questions in .xml file, but since using xml, the questions cannot be upgraded by the admin, so I decided to change the place, to database.

And now I am confused in how to do that..

Thanks for the understanding and help.. :D

Good day.

Is This A Good Question/Topic? 0
  • +

Replies To: How to send and load questions from database?

#2 itdoell  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 239
  • Joined: 13-January 11

Re: How to send and load questions from database?

Posted 23 June 2011 - 12:54 PM

I don't really understand what your question is. You can do this simply with PHP/MySQL.

//input question in an input field
<form name="form" action="something.php" method="post">
<input type="text" name="question">
</form>

//get the question via post
$question = $_POST['question'];

//insert question into database
mysql_query("INSERT INTO questions(question) VALUES('$question')");

//select questions from database
$result=mysql_query("SELECT * FROM questions");
$info = mysql_fetch_assoc($result);

//display question from database
echo $info['question'];



Now of course this is the basics so copying and pasting it won't work, you will also need to set up a database with a table named "questions" and a field named "question". But that's the general idea.

If you're are not familiar with PHP and want to better familiarize yourself with it (which I highly recommend) here are a couple resources.

Nettuts+ video tutorials: http://goo.gl/S4xJ

and of course W3Schools: http://goo.gl/2Xt0

This post has been edited by itdoell: 23 June 2011 - 03:36 PM

Was This Post Helpful? 1
  • +
  • -

#3 puyunk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 27-April 11

Re: How to send and load questions from database?

Posted 24 June 2011 - 08:31 AM

I am sorry for being unclear..

Its just I am making a web based quiz now..
I am kinda confused in how to insert both questions and the answers (multiple answer quiz) to database..

And how to load them up.. If it is possible, I want to load them randomly in my flash movie..

Before, I managed to load the questions and the answers through XML file, but since we cannot upgraded the questions (can be upgrade, but gotta open the XML file), I need to save them into database so that the questions can be upgraded..

Thanks in advance..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1