The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
||||
|
||||
How Do You Do A Loop?
Code:
// Quiz Addon $quiznamez=$DB_site->query_first("SELECT quiztitle, description, quizid, timestamp FROM quiz ORDER BY quizid ASC LIMIT 10"); $quizresults=$DB_site->query_first("SELECT totalcorrect, resulttime FROM quiz_results WHERE userid = '$userinfo[userid]' ORDER BY quizid ASC LIMIT 10"); $totalquestions=$DB_site->query_first("SELECT COUNT(quizid) AS questions FROM quiz_questions WHERE quizid='$quiznamez[quizid]'"); $questions = $totalquestions[questions]; $numA = $quizresults[totalcorrect]; $numB = $questions; $percentage = $numA/$numB*100; $dateposted = date("D j M Y, g:i A",$quiznamez[timestamp]); $taken = date("D j M Y, g:i A",$quizresults[resulttime]); $quizname .="<tr><td bgcolor='#F1F1F1' width=20%><normalfont><b>$quiznamez[quiztitle]</b></normalfont> <smallfont>[ <a href=\"quiz.php?s=&quizid=$quiznamez[quizid]\">Take Quiz</a> ]<br><smallfont>$quiznamez[description]<br><i>Created: $dateposted</i></smallfont></td><td bgcolor='#F1F1F1' width=20%><normalfont>$quizresults[totalcorrect] correct from $questions questions. Giving a percentage of $percentage%.</normalfont><br><smallfont><i>Quiz completed: $taken</i></smallfont></td></tr>\n"; // End Quiz Addon The above is an addon i was making for the quiz. In the member profile i hope to pull the quiz names and the person's results and put them at the bottom of the profile. At the moment the above just pulls one quiz name and one result. I want it to keep going until all the quiz names/results are displayed. I think you use while, but i'm not sure. Could someone help? Also could you let me know if any of the above is wrong. Thanks Craig |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|