R
Rohit S
==========================================================================
Using DBI Perl Programming I get a database o/p as
below
Student SubjectCode Marks
------------------------------------------------
A Ma 90
A Sc 89
B Ma 70
B Sc 71
B Ge 71
C Sc 73
C Ge 97
... ... ...
-------------------------------------------------
Subject code may vary to any value.
I need a report o/p in the following format and
displayed in HTML
Student Ma Sc Ge .....
------------------------------------------------
A 90 89
B 70 71 71
C 73 97
-------------------------------------------------
# chuck all the data into an array
my $students;
while (my $row = $sth->fetchrow_hashref) {
$students->{$row->{$student}}->{$row->{$subject}} = $row->{$mark};
foreach $student(sort keys %$students) {
print $student, "\t";
foreach $subject(sort keys %{$students->{$student}}) {
print "\t", $students->{$student}->{$subject};
}
print "\n";
}
================================================================
The subject field would vary
But this doesnt seem to work.I also need to put the values in an matrix.
Could anyone pls help me out in this.
Regards
Rohit
Using DBI Perl Programming I get a database o/p as
below
Student SubjectCode Marks
------------------------------------------------
A Ma 90
A Sc 89
B Ma 70
B Sc 71
B Ge 71
C Sc 73
C Ge 97
... ... ...
-------------------------------------------------
Subject code may vary to any value.
I need a report o/p in the following format and
displayed in HTML
Student Ma Sc Ge .....
------------------------------------------------
A 90 89
B 70 71 71
C 73 97
-------------------------------------------------
# chuck all the data into an array
my $students;
while (my $row = $sth->fetchrow_hashref) {
$students->{$row->{$student}}->{$row->{$subject}} = $row->{$mark};
foreach $student(sort keys %$students) {
print $student, "\t";
foreach $subject(sort keys %{$students->{$student}}) {
print "\t", $students->{$student}->{$subject};
}
print "\n";
}
================================================================
The subject field would vary
But this doesnt seem to work.I also need to put the values in an matrix.
Could anyone pls help me out in this.
Regards
Rohit