i want to create something like a 2d array structure i've done the following will this work?
my $sth5 = $dbh->prepare("SELECT round, teamname, score from trees whe
+re sport = ‘$sport’ and year = ‘$year’, ORDER BY round DESC") || die
+"Can't prepare SQL get data statement";
$sth5->execute || die “can’t execute sql statement”;
##need to get all the data one row at a time from the table.
my @row;
$rowcount = 0;
while (@row = $sth5->fetchrow_array) {
$round = $row[0];
$teamname = $row[1];## need to put each row into list_ $Score =
+ $row[2];## of_lists a variable at a time
push (@{list_of_teamdata[$rowcount]}, qw($round $teamname $score);
$rowcount++;
}
This creates a list of structure
round teamname score
round teamname score
round teamname score
round teamname score
etc
i then need to substitute values from the list into the html document
my $compsize = $#list2+1;
If ($compSize = 7);
Print “Content-Type: text/html\n\n”;
Print “<html>\n”
Print “<head>\n”
Print “<title> tree7</title>\n”
Print “</head>\n”
Print “<body>\n”
Print “<table border="1" width="100%">\n”
Print “<tr>\n”
Print “<td width="9%"> </td>\n”
Print “<td width="9%"> </td>\n”
Print “<td width="9%"> </td>\n”
Print “<td width="9%"><b>$list_of_teamdata [6][1]</b></td>\n”
Print “<td width="9%"><b>$list_of_teamdata [6][2] </b></td>\n”
is this correct. i realise this is not the best way but i'm very new
+to perl and cgi programming.
|