I am lost . I have this quiz program , It prints and grades the quiz . now
the managers want to make it put out random tests
My Code :
$dbh =DBI ->connect($data_source, $username, $password) or die "cant
connect
to $data_source : my $dbh-> errstr\n";
my $sth1 = $dbh -> prepare("select num from tests where subject = '$test'
");
$sth1 -> execute or die " unable to execute query ";
#$sth1 -> finish;
my $array_ref = $sth1 -> fetchall_arrayref();
$count = 0;
foreach $row(@$array_ref){
my($num) = @$row;
@numbers[$count] = $num;
$count++;
}
$r_num = rand(@numbers);
$dbh =DBI ->connect($data_source, $username, $password) or die "cant connect
to
$data_source : my $dbh-> errstr\n";
my $sth1 = $dbh -> prepare("select * from tests where num = '$r_num' ");
$sth1 -> execute or die " unable to execute query ";
#$sth1 -> finish;
__________________________________
I figured to query on the test question numbers ( the are unique) then
randomize the numbers. This table has other test questions as well. When I
randomize the NUM s returns from the query, I thought I would re-query for
the whole record where num = randomize number. I dont know if that is the
best way to go .
but I am now stuck , its not randomizing . In fact its not doing anything
help !
Jim
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]