Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$sport = 'basket ball' $sth5 = $dbh->prepare("SELECT round, teamname, score from trees where +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";
i want to produce the following data structure after this while loop executes$rowcount = 0; while (@row = $sth5->fetchrow_array()) { $round = $row[0]; $teamname = $row[1]; $Score = $row[2]; push @ list_of_teamdata, qw("$round $teamname $score"); $rowcount++; }
so that i can reference these variables from the lists of lists created by the above. and output them into the html as follows.round 1 team 1 score 1 round 2 team 2 score 2 round 3 team 3 score 3 round 4 team 4 score 4
$compsize = $#list1+1; if ($compSize == 7){ print "<tr>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\">image3</td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"10%\"> </td>\n"; print "</tr>\n"; print "<tr>\n"; print "<td width=\"9%\"><b><P align=center><SELECT name=Team6 size=1 +>\n"; print "<OPTION selected value=101>$list_of_teamdata[5][1]</OPTION>\n +"; print "<OPTION value=102>Business School</OPTION>\n"; print "<OPTION value=103>Admin/Estates</OPTION>\n"; print "<OPTION value=104>CEAC </OPTION>\n"; print "<OPTION value=105>Civ Eng</OPTION>\n"; print "<OPTION value=106>Combined Honours</OPTION>\n"; print "<OPTION value=107>CSAM</OPTION>\n"; print "<OPTION value=108>EEAP</OPTION>\n"; print "<OPTION value=109>MechEng</OPTION>\n"; print "<OPTION value=110>ModLang</OPTION>\n"; print "<OPTION value=111>Vision Sciences</OPTION>\n"; print "<OPTION value=112>Pharmacy</OPTION>\n"; print " </SELECT>\n"; print "</P>\n"; print "</td>\n"; print "</b>\n"; print "<td width=\"9%\"><b><P align=center><SELECT name=score6 size= +1>\n"; print "<OPTION selected value=101>$list_of_teamdata[5][2]</OPTION>\n +"; print "<OPTION value=103>0</OPTION>\n"; print "<OPTION value=103>1</OPTION>\n"; print "<OPTION value=104>2</OPTION>\n"; print "<OPTION value=105>3</OPTION>\n"; print "<OPTION value=106>4</OPTION>\n"; print "<OPTION value=107>5</OPTION>\n"; print "<OPTION value=108>6</OPTION>\n"; print "<OPTION value=109>7</OPTION>\n"; print "<OPTION value=110>8</OPTION>\n"; print "<OPTION value=111>9</OPTION>\n"; print "<OPTION value=112>10</OPTION>\n"; print "<OPTION value=113>11</OPTION>\n"; print "<OPTION value=114>12</OPTION>\n"; print " </SELECT>\n"; print "</P>\n"; print "</td>\n"; print "</b>\n"; print "<td width=\"9%\">image3</td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"10%\"> </td>\n"; print "</tr>\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%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"10%\"> </td>\n"; print "</tr>\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%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"9%\"> </td>\n"; print "<td width=\"10%\"> </td>\n"; print "</tr>\n"; print "</table>\n"; print "</body>\n"; print "</html>\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dbi issues
by lachoy (Parson) on Apr 01, 2001 at 03:31 UTC |