--- db/prgsrc/db.cgi 2000/10/24 17:59:25 1.11 +++ db/prgsrc/db.cgi 2000/10/24 18:03:49 1.12 @@ -465,12 +465,18 @@ sub GetQNum { $sth->execute; return ($sth->fetchrow)[0]; } +sub GetMaxQId { + my ($dbh) = @_; + my ($sth) = $dbh->prepare("SELECT MAX(QuestionId) FROM Questions"); + $sth->execute; + return ($sth->fetchrow)[0]; +} # Returns Id's of 12 random questions sub Get12Random { my ($dbh, $type, $num) = @_; my ($i, @questions, $q, $t, $sth); - my ($qnum) = &GetQNum($dbh); + my ($qnum) = &GetMaxQId($dbh); my (%chosen); srand;