Debian Codegraph @

eg/x/recordset.htm

raw
1
2 <html>
3 <head>
4 <title>Embperl Examples - DBIx::Recordset</title>
5 </head>
6 <body background="../images/jazzbkgd.gif">
7
8 <h1>Embperl Examples - DBIx::Recordset</h1>
9 <hr><b>NOTE:</b><br>
10 You must set the database and table to something which exists on your system.
11 Also this example presumes that the table contains the fields <b>id</b> and
12 <b>name</b>. If not you have to change the field-names in the table below<br>
13 Maybe it's necessary to insert a PerlModule DBIx::Recordset into your srm.conf
14 to get this working<br>
15 <br>
16 You may specify search parameters: For example request this document with<br>
17 <b>recordset.htm?id=5</b><br>
18 to get all records where the id = 5
19
20 <hr>
21
22 [-
23
24 $DSN = 'dbi:mysql:test' ;
25 $table = 'dbixrs1' ;
26
27 use DBIx::Recordset ;
28
29 *set = DBIx::Recordset -> Search ({%fdat,
30 ('!DataSource' => $DSN,
31 '!Table' => $table,
32 '$max' => 5,)}) ; -]
33 <table border=1>
34 <tr><th>ID</th><th>NAME</th></tr>
35 <tr>
36 <td>[+ $set[$row]{id} +]</td>
37 <td>[+ $set[$row]{name} +]</td>
38 </tr>
39 </table>
40 [+ $set -> PrevNextForm ('Previous Records', 'Next Records', \%fdat) +]
41
42 <p><hr>
43
44 <small>HTML::Embperl (c) 1997-1998 G.Richter</small>
45
46
47 </body>
48 </html>