"); $quiz = mysql_query("select * from quiz where active = 'Y' order by quizid desc limit 0,1"); $quiz = mysql_fetch_array($quiz); $quest = mysql_query("select * from quiz_q where quiz = '$quiz[quizid]' order by qid"); $quizid = $quiz[quizid]; } else { //echo("Is id. ".$quizid."
"); $quest = mysql_query("select * from quiz_q where quiz = '$quizid' order by qid"); } $numq = mysql_num_rows($quest); } else { if($quizid) { $urltp = "quiz.php?qsub=99&quizid=".$quizid; //get all the questions $quest = mysql_query("select * from quiz_q where quiz = '$quizid' order by qid"); $numq = mysql_num_rows($quest); $display=array(); $numright=0; //now see how many were correct and put all answers into array for display for($i=0;$i<$numq;$i++) { $row = mysql_fetch_array($quest); $display[$i][0] = $row[qid]; $display[$i][1] = $row[question]; $display[$i][2] = $row[image]; $tmp = $row[qid]; $urltp.="&".$tmp."=".$$tmp; //now get all the answers $correct = mysql_query("select * from quiz_a where question = '$row[qid]' and correct = 'Y'"); $correct = mysql_fetch_array($correct); if($$tmp==$correct[letter]) $numright++; } $urltp = urlencode($urltp); } else $error = true; } format_pre("N", "TheGlasgowStory Quiz", $feature, $_COOKIE); /******************************************* * Code to run if submit button not pressed * *******************************************/ if(!$qsub) { /******************* * Log quiz viewing * *******************/ $date = date(U); $log = mysql_query("insert into accesslog set ip = '$userip', uname = '$user', logdate = '$date', actiontype = 'Quiz Questions', details = 'Quiz ID = ".$quiz[quizid]."'"); $urltp = "quiz.php"; ?>

TheGlasgowStory Quiz

Each month TheGlasgowStory features a quiz. Can you answer all the questions?

If you can give the correct answers to 4 questions or more, then you must be pure gallus. And if you get 2 or less? You're a tumshie!

You can use the website to find answers - simply go to the search option and type in words that you think might help you to locate the relevant information. Each answer also comes with a link to a relevant captioned image.

"); //display all questions for($i=0;$i<$numq;$i++) { $row = mysql_fetch_array($quest); $tmp = $i+1; echo("

".$tmp.": ".$row[question]."

"); //now get all the answers $ans = mysql_query("select * from quiz_a where question = '$row[qid]' order by letter"); $numans = mysql_num_rows($ans); for($j=0;$j<$numans;$j++) { $r = mysql_fetch_array($ans); echo("  ".$r[letter]." ".$r[answer]."
"); } echo("

"); } echo("

"); echo("

Try a different quiz:

"); for($i=0;$i<$numquizes;$i++) { $row = mysql_fetch_array($quizlist); if($row[quizid]==$quizid) echo($row[name]." | "); else echo("".$row[name]." | "); } echo("

"); } else { /******************* * Log quiz answers * *******************/ $date = date(U); $log = mysql_query("insert into accesslog set ip = '$userip', uname = '$user', logdate = '$date', actiontype = 'Quiz Answers', details = 'Quiz ID = ".$quizid.", ".$numright." correct'"); ?>

Quiz Results

There was an error running the quiz.

"); else { echo("

You got ".$numright." question"); if($numright!=1) echo("s"); echo(" correct!

"); } for($i=0;$i<$numq;$i++) { $tmp = $i+1; $qid = $display[$i][0]; echo("

".$tmp.": ".$display[$i][1]."

"); //now get all the answers $ans = mysql_query("select * from quiz_a where question = '$qid' order by letter"); $numans = mysql_num_rows($ans); for($j=0;$j<$numans;$j++) { $r = mysql_fetch_array($ans); echo("  ".$r[letter]." ".$r[answer]."
"); } echo("

"); if($right==true) echo("Pure Gallus!"); else echo("Tumshie!"); echo("
The Answer was ".$rightanswer); if($display[$i][2]) echo(". Find out more"); echo(".

"); unset($right); unset($rightanswer); } echo("

Do you want to try again?

"); } format_post($select_num, $user, "quiz.php");