M
Mavis
Hi,
I'm trying to use a simple form to select by which column I will display
output from a MySQL database.
I'd like to display based on ORDER BY and select Written, Average, etc.
I know the data is getting to the script from the post, I just can't get it
to the select statement.
Here is the code:
#!/usr/bin/perl
use DBI;
$sizeOfFormInformation = $ENV{'CONTENT_LENGTH'};
read (STDIN, $form_info, $sizeOfFormInformation);
($field_name, $command) = split (/=/, $form_info);
my $dbh = DBI->connect ('DBI:mysql:eln8220s02', root) or die "Couldn't
connect to database: " . DBI->errstr;
my $sth = $dbh->prepare('
select marks.Last_Name, min(marks.Score) as Minimum, max(marks.Score) as
Maximum, avg(marks.Score) as Average, count(marks.Score) as Count from marks
where marks.Type = "quiz" and marks.Score > 0 group by Last_Name order by
[THIS IS WHERE I WANT TO INSERT THE POST DATA] desc
') or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute;
Any help would be appreciated.
Thanks.
I'm trying to use a simple form to select by which column I will display
output from a MySQL database.
I'd like to display based on ORDER BY and select Written, Average, etc.
I know the data is getting to the script from the post, I just can't get it
to the select statement.
Here is the code:
#!/usr/bin/perl
use DBI;
$sizeOfFormInformation = $ENV{'CONTENT_LENGTH'};
read (STDIN, $form_info, $sizeOfFormInformation);
($field_name, $command) = split (/=/, $form_info);
my $dbh = DBI->connect ('DBI:mysql:eln8220s02', root) or die "Couldn't
connect to database: " . DBI->errstr;
my $sth = $dbh->prepare('
select marks.Last_Name, min(marks.Score) as Minimum, max(marks.Score) as
Maximum, avg(marks.Score) as Average, count(marks.Score) as Count from marks
where marks.Type = "quiz" and marks.Score > 0 group by Last_Name order by
[THIS IS WHERE I WANT TO INSERT THE POST DATA] desc
') or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute;
Any help would be appreciated.
Thanks.