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
 
 

Reply via email to