» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2006, 02:29 PM
robertson robertson is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
robertson is on a distinguished road
Default online quiz query

Hi, suggestions welcomed

I have an online quiz(zes) to make for a site. The quizzes themselves will not change much I have been throwing around the idea in my head on how to best accomplish this. All questions will be displayed on a single page with a submittal showing number of answers correct, percentage, and answers/explanation.

DB first:
Idea 1:
question table: question_id, question_text, question_answer, question_explanation, question_url
solution table: solution_id, question_id, solution_text

Idea 2:
question table: question_id, question_text, question_answer, question_explanation, question_url, question_solution1, question_solution2, question_solution3, question_solution4

The most a question can have is four answers (maybe change in the future) but some only have two; this leads to me preferring Idea 1.

Now the question is, what is the best way to get this information out of th -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-08-2006, 02:32 PM
snorter snorter is offline
Junior Member
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
snorter is on a distinguished road
Default

first you should use your first idea

to pull the data out you'll be wanting to use a bit of code like

PHP Code:
$sql = "SELECT * FROM question";
$result = mysql_connect("localhost", $sql);
$row = mysql_fetch_assoc($result);



that way you can pull question data by calling on the variable $row['name of row here'];

then to pull from the solution table use

PHP Code:
$question_id = $row['question_id'];
$sql2 = "SELECT * FROM solution WHERE question_id = '$question_id'";
$result2 = mysql_connect("localhost", $sql2);
$row2 = mysql_fetch_assoc($result2);


and then display the data from there with $row2['enter row name here']; -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
GoDaddy.com Launches Online Photo Filer outsourcingplans Web Hosting News 0 12-27-2006 03:42 AM
Welcome to free online sex cam on OutSourcingPlans... osp Introductions 0 08-31-2006 12:31 AM
Mysql_affected_rows() isn't working on a delete query? zizu PHP Programming and Tips 1 08-26-2006 03:05 PM
Query works on production but not on testing server parore MySQL Forums 1 07-31-2006 04:11 PM
Tic Tac Websites Unveils 'Easy Online Website Builder' outsourcingplans Web Hosting News 0 01-04-2006 03:55 PM


All times are GMT. The time now is 12:25 AM.