develooper Front page | perl.beginners | Postings from March 2002

I have a script that print test questions and grades them... how do I make them print a random order

From:
FLAHERTY, JIM-CONT
Date:
March 27, 2002 08:19
Subject:
I have a script that print test questions and grades them... how do I make them print a random order
Message ID:
6D0317C617A8D3119EC000A0C9FC45240190AA54@kinx68322m1.cnet.navy.Mil
I have a script that print test questions and grades them... how do I make
them print a random order, and a certain amount ??  
 
code 
@@@@@@@@@@@@@@@@
 

$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 subject = '$test' ");
$sth1 -> execute or die " unable to execute query ";
#$sth1 -> finish;
 
 
##################
 
the table 
mysql> show columns from tests;
+---------+--------------+------+-----+---------+----------------+
| Field   | Type         | Null | Key | Default | Extra          |
+---------+--------------+------+-----+---------+----------------+
| num     | int(5)       |      | PRI | NULL    | auto_increment |
| subject | varchar(200) | YES  |     | NULL    |                |
| ques    | longtext     | YES  |     | NULL    |                |
| quesA   | longtext     | YES  |     | NULL    |                |
| quesB   | longtext     | YES  |     | NULL    |                |
| quesC   | longtext     | YES  |     | NULL    |                |
| quesD   | longtext     | YES  |     | NULL    |                |
| quesE   | longtext     | YES  |     | NULL    |                |
| ans     | varchar(20)  | YES  |     | NULL    |                |
| corr_a  | char(2)      | YES  |     | NULL    |                |
| corr_b  | char(2)      | YES  |     | NULL    |                |
| corr_c  | char(2)      | YES  |     | NULL    |                |
| corr_d  | char(2)      | YES  |     | NULL    |                |
| corr_e  | char(2)      | YES  |     | NULL    |                |
| exp     | longtext     | YES  |     | NULL    |                |
| pipe    | varchar(20)  | YES  |     | NULL    |                |
+---------+--------------+------+-----+---------+----------------+
16 rows in set (0.00 sec)
 
mysql>

 
 
 
thanks 
Jim
 
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About