Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,553 members, 7,955,057 topics. Date: Saturday, 21 September 2024 at 03:38 PM |
Nairaland Forum / Science/Technology / Webmasters / Urgent Help 4rm My Esteemed Webmasters! (851 Views)
Collect And Extract Emails,phone And Fax Numbers 4rm The Websites Around D World / How To Translate A Scanned Jpeg Document Into English: Urgent Help Pls! / Urgent: Help Recover My Article Site Admin's - Articlebeach Script (2) (3) (4)
Urgent Help 4rm My Esteemed Webmasters! by Benny95(m): 12:01pm On Dec 18, 2013 |
So I'm working on a computer based test(CBT) web app, on a php platform, I'v gon a lil far in it, upto d point of rendering d questions(randomly) 2d user, my problem nw is how do I mark d test and give d user his/her score? Just a pseudo, thanks in anticipation. |
Re: Urgent Help 4rm My Esteemed Webmasters! by Afam4eva(m): 12:05pm On Dec 18, 2013 |
Benny95: So I'm working on a computer based test(CBT) web app, on a php platform, I'v gon a lil far in it, upto d point of rendering d questions(randomly) 2d user, my problem nw is how do I mark d test and give d user his/her score? Just a pseudo, thanks in anticipation.Shouldn't you have a database of the questions and the answers such that it juxtaposes the user's answer to the correct and answer and assign a score and at the end, it does a calculation to arrive at the final score. |
Re: Urgent Help 4rm My Esteemed Webmasters! by Benny95(m): 12:12pm On Dec 18, 2013 |
Afam4eva: Yeah I do, I'm using mongoDB as d database, I can also use mysql tho, I'm just looking 4 a way 2 loop through all d user-supplied answers and compare to the answers in my DB........fanks |
Re: Urgent Help 4rm My Esteemed Webmasters! by elvis10ten(m): 5:24pm On Dec 18, 2013 |
Benny95: <?php $pos = 0; $db = new mysqli('server', 'username', 'password', 'dbName'); if($db->connect_errno > 0) { die('Unable to connect to database'.$db->connect_error); } $stmt = $db->prepare("SELECT `id`, `answer` FROM `question` LIMIT ?, 10" $stmt->bind_param('i', $pos); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $answer); while($stmt->fetch()) { $answers[$id] = $answer; } $db->close(); $score = 0; foreach($_POST as $key => $value) { if($value == $answers[$key]) { $score += 1; } } ?> please edit the query and other mysqli_ ish stuff. The code above expect your html input tag names to be the id of the question from the db. |
Re: Urgent Help 4rm My Esteemed Webmasters! by Benny95(m): 1:05am On Dec 19, 2013 |
elvis10ten:Thanks! |
Re: Urgent Help 4rm My Esteemed Webmasters! by elvis10ten(m): 10:04am On Dec 19, 2013 |
Benny95: Thanks!ur welcome. |
(1) (Reply)
Making A Good Android App For Your Blog / I Need Someone To Design And Replecate This Logo's For Me For Small Amount. / Is Godaddy A Good Web Host? Please Share Your Experience!
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16 |