chiark / gitweb /
Remove the clone-and-hack database initialisation from web scripts
[ypp-sc-tools.db-live.git] / yarrg / web / pirates
1 <HTML>
2 <HEAD>
3 <TITLE>test pirate page</TITLE>
4 </HEAD>
5 <BODY>
6
7 <html><head><title>Select island</title></head><body>
8 <form action="/ucgi/~clareb/mason/something" method="get">
9 <select name="islandid">
10 <%perl>
11 my $sth=$dbh->prepare("SELECT islandid,archipelago,islandname
12                               FROM islands
13                               ORDER BY archipelago,islandname;");
14 $sth->execute();
15 </%perl>
16 % my $row;
17 % while ($row=$sth->fetchrow_hashref) {
18 <option value="<% $row->{'islandid'} |h %>"><% $row->{'archipelago'} |h %> -
19 <% $row->{'islandname'} |h %>
20 % }
21 <input type=submit name=submit value="Go">
22 </form>
23
24 my $sth=$dbh->prepare(
25     "SELECT a.commodname,b.price,c.price,d.stallname,e.islandname
26      FROM commods as a
27      JOIN buy as b on a.commodid=b.commodid
28      JOIN buy as c on a.commodid=c.commodid
29      JOIN stalls as d on d.stallid=b.stallid
30      JOIN islands as e on e.islandid=d.islandid
31      WHERE a.commodname like 'Wood'
32      ");
33
34 $sth->execute();
35 </%perl>
36 <table frame=box rules=all>
37 <!--
38 <tr><td>Island</td><td>Arch</td><td>Stall</td><td>buy price</td><td>sell price</td></tr>
39 -->
40 % my @row;
41 % while (@row=$sth->fetchrow_array) {
42 <tr>
43 % foreach my $cell (@row) {
44 <td>
45 <% $cell %>
46 </td>
47 % }
48 </tr>
49 % }
50 </table>
51
52 </BODY>
53 </HTML>
54
55 <%init>
56 use CommodsWeb;
57 db_setocean('Midnight');
58 db_connect();
59 </%init>