Leser: 18
1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- Navi -->
<TMPL_LOOP NAME="box_list">
<div class="navi_box">
<fieldset>
<legend><TMPL_VAR NAME="box_name"></legend>
<TMPL_LOOP NAME="box_links">
<TMPL_VAR NAME="link">
</TMPL_LOOP>
</fieldset>
</div>
</TMPL_LOOP>
QuoteSELECT box_name FROM navibox
QuoteSELECT id,link_titel,link,categorie,box_name,option,content FROM navigation WHERE box_name=?
1
2
3
4
5
6
7
8
9
box_list => [
{
box_name => 'irgendein name',
box_links => [
{ link => 'linktext1' },
{ link => 'linktext2' },
]
}
]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
my $stmt_box_name = 'SELECT box_name FROM navibox'; my $stmt_links = 'SELECT id,link_titel,link,categorie,box_name,option,content FROM navigation WHERE box_name=?'; my $sth_box_name = $dbh->prepare( $stmt_box_name ) or die $dbh->errstr; my $sth_links = $dbh->prepare( $stmt_links ) or die $dbh->errstr; $sth_box_name->execute or die $dbh->errstr; my @boxes; while( my ($box_name) = $sth_box_name->fetchrow_array ) { $sth_links->execute( $box_name ); my @links; while( my $hashref = $sth_links->fetchrow_hashref ) { push @links, { link => $hashref->{link} }; } push @boxes, { box_name => $box_name, box_links => \@links }; } $template->param( box_list => \@boxes );
2009-12-30T12:26:41 murphystimmt!Soweit ich weiß sind fetchrow_... Methoden des Statementhandles nicht des Datenbankhandles!
2009-12-30T12:26:41 murphySollte eigentlich funktionieren...Falls ich mich da irre, wird der Code allerdings trotzdem nicht funktionieren, da die Ausführung eines weiteren Statements dann sicherlich das Ergebnis des vorhergehenden verwirft.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#!/Perl/bin/perl
package CatcherInTheRye;
use strict;
use warnings;
use base qw/CGI::Application/;
use CGI::Application::Plugin::Forward;
use CGI::Application::Plugin::Redirect;
use CGI::Application::Plugin::HTCompiled;
use CGI::Application::Plugin::Session;
use CGI::Application::Plugin::MessageStack;
use CGI::Application::Plugin::DBH (qw/dbh dbh_config/);
use Data::Dumper qw/Dumper/;
our $VERSION = 0.1;
=head1 NAME
CatcherInTheRye - a boring book
=head1 DESCRIPTION
Beispiel für die Verwendung von SQLite. create_db erzeugt eine Datenbank mit
Testdaten, explore_db zeigt die Testdaten an. Beides kann über den
start-runmode start erreicht werden.
=head1 METHODS
=cut
=head2 cgiapp_init()
Open database connection, setup config files, etc.
=cut
sub cgiapp_init {
my $self = shift;
# -- use the same args as DBI->connect();
my $db_cfg = {
dsn => 'dbi:SQLite:dbname=test.db',
username => '',
password => '',
attributes => {
RaiseError => 1,
AutoCommit => 1,
sqlite_unicode => 1,
},
};
$self->dbh_config($db_cfg->{dsn}, $db_cfg->{username}, $db_cfg->{password},
$db_cfg->{attributes});
# -- configure CAP::MessageStack to auto clear messages
$self->capms_config(
-automatic_clearing => 1,
);
} # /cgiapp_init
=head2 setup()
Defined runmodes, etc.
=cut
sub setup {
my $self = shift;
$self->start_mode('start');
$self->run_modes([qw/
start
create_db
explore_db
/]);
} # /setup
=head2 start()
Zeige ein Formular, mit dem die Datenbank erstellt werden kann + den Link zur
Anzeige der Datenbank-Daten. Die Datenbank sollte wahrschienlich besser erzeugt
werden, *bevor* deren Inhalt angezeigt wird.
=cut
sub start {
my $self = shift;
my $tmpl = q~
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
<title>SQLite-Test</title>
</head>
<body>
<h1>Test von SQLite</h1>
<!-- TMPL_LOOP NAME="CAP_Messages" -->
<div class="<!-- TMPL_VAR NAME="classification" -->">
<!-- TMPL_VAR NAME="message" -->
</div>
<!-- /TMPL_LOOP -->
<form action="<TMPL_VAR c.query.url>" method="POST">
<input type="hidden" name="rm" value="create_db" />
<input type="submit" value="create db" />
</form>
<a href="<TMPL_VAR c.query.url>?rm=explore_db">explore db</a>
</body>
</html>
~;
my $t = $self->load_tmpl(\$tmpl);
return $t->output();
} # /start
=head2 create_db()
Create a SQLite databse and fill in some values.
=cut
sub create_db {
my $self = shift;
my $dbh = $self->dbh();
$dbh->do(q{DROP TABLE If EXISTS persons});
$dbh->do(q{
CREATE TABLE persons (
id INTEGER PRIMARY KEY AUTOINCREMENT,
first_name VARCHAR(255),
last_name VARCHAR(255)
)
});
$dbh->do(q{DROP TABLE If EXISTS groups});
$dbh->do(q{
CREATE TABLE groups (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title VARCHAR(255)
)
});
$dbh->do(q{DROP TABLE If EXISTS persons2groups});
$dbh->do(q{
CREATE TABLE persons2groups (
id INTEGER PRIMARY KEY AUTOINCREMENT,
person_id INTEGER,
group_id INTEGER
)
});
my $grp_stmt = $dbh->prepare(q{INSERT INTO groups (title) VALUES (?)});
for my $data ( 'admin', 'user', 'guest' ) {
$grp_stmt->execute($data);
}
my $usr_stmt = $dbh->prepare(q{
INSERT INTO persons (first_name, last_name) VALUES (?, ?)});
for my $data ( ['mr.','admin'], ['mäh','maz'], ['john','smith'] ) {
$usr_stmt->execute(@{$data}[0,1]);
}
my $usr_grp_stmt = $dbh->prepare(q{
INSERT INTO persons2groups (person_id, group_id) VALUES (?, ?)});
for my $data ( [1,1], [1,2], [1,3], [2,3], [3,2] ) {
$usr_grp_stmt->execute(@{$data}[0,1]);
}
$self->push_message(
-scope => 'start',
-message => localtime() . ' - Your db has been created',
-classification => 'INFO',
);
return $self->redirect( $self->query->url() . '?rm=start' );
} # /create_db
=head2 explore_db()
Display some data.
=cut
sub explore_db {
my $self = shift;
my $dbh = $self->dbh();
my $sth = $dbh->prepare(q{SELECT * FROM persons})
or die('error preparing: ' . DBI->errstr());
my $rv = $sth->execute() or die('error executing: ' . DBI->errstr());
my @all_persons_loop = ();
while( my $user_data = $sth->fetchrow_hashref ) {
my $user_id = $user_data->{id};
my %data_of_one_user = (
first_name => $user_data->{first_name},
last_name => $user_data->{last_name},
groups => [], # we don't have those yet
);
# -- now get the groups
my $grp_sth = $dbh->prepare(q{
SELECT g.title
FROM persons2groups p2g
LEFT JOIN groups g ON g.id = p2g.group_id
WHERE person_id = ?
}) or die('error preparing: ' . DBI->errstr());
my $grp_rv = $grp_sth->execute($user_id)
or die('error executing: ' . DBI->errstr());
while( my $grp_data = $grp_sth->fetchrow_arrayref() ) {
# -- Bitte fragen, wenn das unklar ist:
push @{$data_of_one_user{'groups'}}, { title => $grp_data->[0] };
}
push @all_persons_loop, \%data_of_one_user;
}
my $tmpl = q~
<html>
<body>
<a href="<TMPL_VAR c.query.url>">zurück</a>
<ul>
<TMPL_LOOP all_persons>
<li><TMPL_VAR first_name> <TMPL_VAR last_name>,
Mitglied in folgenden Gruppen:<br />
<ul>
<TMPL_LOOP groups>
<li><TMPL_VAR title></li>
</TMPL_LOOP>
</ul>
</li>
</TMPL_LOOP>
<hr />
<p>So sieht die Datenstruktur aus:<br />
<pre><TMPL_VAR dump></pre>
</p>
</ul>
</body>
</html>
~;
my $t = $self->load_tmpl(\$tmpl);
$t->param('dump' => Dumper(\@all_persons_loop));
$t->param('all_persons' => \@all_persons_loop);
return $t->output();
} # /explore_db
=head1 LICENSE
This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself, either Perl version 5.8.8 or, at your option,
any later version of Perl 5 you may have available.
=cut
1;
use strict;
use warnings;
use FindBin qw/$Bin/;
my $app = CatcherInTheRye->new();
$app->run();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
my $sth_box_name = $dbh->prepare("SELECT box_name FROM navibox") or die $dbh->errstr; my $sth_links = $dbh->prepare("SELECT id,link_titel,link,categorie,box_name,option,content FROM navigation WHERE box_name=?") or die $dbh->errstr; $sth_box_name->execute or die $dbh->errstr; my @boxes; while( my $box_name = $sth_box_name->fetchrow_array ) { $sth_links->execute($box_name); my @links; while( my $hashref = $sth_links->fetchrow_hashref ) { push @links, { link => $hashref->{link} }; } push @boxes, { box_name => $box_name, box_links => \@links }; } $sth_box_name->finish(); $sth_links->finish();
Guest BobHallo,
Außerdem habe ich noch eine kleine Frage.
Ich habe gesehen, das "fetchrow_hashref" beim 2ten Handle benutzt wird. Ich kenne allerdings nur "fetchrow_array()", welches die Spalten bei jedem durchlauf in ein Array ablegt. Gibt es noch mehr von denen? und wozu benötige ich die "anderen" , also zb "fetchrow_hashref" etc..
Lg
Bob
Guest BobHallo,
vielen Dank für eure Antworten.
Leider werden nur die BoxNamen ausgegeben, Links erscheinen allerdings nicht.
Soweit hatte ich es auch schon, nur ist mein Problem halt die Links auszugeben.
In der Datenbank exestieren aufjedenfall dazu Einträge., weshalb der Code einen Fehler beinhalten muss.
Wenn ich mir versuche den Hashref Ohne pushen einfach auf die seite aus zu printen, erscheint dort auch nichts.
[...]
Lg
Bob
1
2
3
4
5
6
7
use Data::Dumper qw/Dumper/;
my %h = (
a => [qw/1 2 3/],
b => 'keks',
);
print Dumper(\%h);
1 2 3 4 5 6 7 8
# ----- Template Parameter ------ # $template->param( posts => \@posts, zurueck => $html_newer, naechste => $html_older, box_list => \@boxes ); print $template->output();
2009-12-30T12:47:57 renee[...]
2009-12-30T12:26:41 murphySollte eigentlich funktionieren...Falls ich mich da irre, wird der Code allerdings trotzdem nicht funktionieren, da die Ausführung eines weiteren Statements dann sicherlich das Ergebnis des vorhergehenden verwirft.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
#!/usr/bin/perl use strict; use warnings; use CGI; use CGI qw(:standart); use CGI::Carp qw(fatalsToBrowser); use HTML::Template; use DBI; use POSIX; require('config.cgi'); our %config; my $cgi = new CGI; print $cgi->header(); # ---------- Ip auf Blackliste überprüfen ---------- # my $dbh = DBI->connect("dbi:mysql:$config{'mysql_db'}:$config{'mysql_host'}","$config{'mysql_user'}","$config{'mysql_pass'}") || die("$DBI::errstr\n"); my $sth = $dbh->prepare("SELECT * FROM blacklist WHERE ip=?") || die("$DBI::errstr\n"); $sth->execute($ENV{'REMOTE_ADDR'}) || die("$DBI::errstr\n"); my $request= $sth->fetchrow_array(); $sth->finish(); $dbh->disconnect; # ---------- Bei auftretender Ip beenden ---------- # exit if ($request ne ""); # ---------- Settings lesen ---------- # my $dbh = DBI->connect("dbi:mysql:$config{'mysql_db'}:$config{'mysql_host'}","$config{'mysql_user'}","$config{'mysql_pass'}") || die("$DBI::errstr\n"); my $sth = $dbh->prepare("SELECT blogname,messages_per_page FROM settings") || die("$DBI::errstr\n"); $sth->execute(); my @settings = $sth->fetchrow_array(); $sth->finish(); my $blogname = $settings[0]; my $proseite = $settings[1]; ########################################################################################################################### # ---------- Navigation lesen ---------- # my $sth_box_name = $dbh->prepare("SELECT box_name FROM navibox") or die $dbh->errstr; my $sth_links = $dbh->prepare("SELECT id,link_titel,link,categorie,box_name,option,content FROM navigation WHERE box_name=?") or die $dbh->errstr; $sth_box_name->execute or die $dbh->errstr; my @boxes; while( my $box_name = $sth_box_name->fetchrow_array ) { $sth_links->execute($box_name); my @links; while( my $hashref = $sth_links->fetchrow_hashref ) { push @links, { link => $hashref->{link} }; } push @boxes, { box_name => $box_name, box_links => \@links }; } $sth_links->finish(); $sth_box_name->finish(); ########################################################################################################################### my $page = CGI::param('page'); if ($page !~ /^\d*$/) { $page = 0; } my $perm = CGI::param('perm'); if ($perm eq "") { &index(); } else { if ($perm !~ /^\d*$/) { $perm = 0; } &perm(); } # ---------- Hauptseite ---------- # sub index() { my $template = HTML::Template->new(filename => "$config{'path'}/index.tmpl"); my $start = $page * $proseite; # ---------- Anzahl der Blogeinträge zählen ---------- # $sth = $dbh->prepare("SELECT COUNT(*) as anzahl FROM posts") || die("$DBI::errstr\n"); $sth->execute() || die("$DBI::errstr\n"); my $anzahl = $sth->fetchrow_array(); $sth->finish(); # ---------- Seiten berechnen ---------- # my $seiten = ceil($anzahl / $proseite); if ($page > $seiten - 1){$page = 0; $start = $page * $proseite;} # ---------- Einträge für jeweilige Seite auslesen ---------- # $sth = $dbh->prepare("SELECT * FROM posts order by date DESC Limit $start,$proseite") || die("$DBI::errstr\n"); $sth->execute() || die("$DBI::errstr\n"); my @posts; my $comment_str; while(my @post_infos = $sth->fetchrow_array()) { # ---------- Anzahl der Kommentare zählen ---------- # $anzahl = ""; my $sth2 = $dbh->prepare("SELECT COUNT(*) as anzahl FROM comments WHERE post_perm=? AND unlocked=?") || die("$DBI::errstr\n"); $sth2->execute($post_infos[0],1) || die("$DBI::errstr\n"); $anzahl = $sth2->fetchrow_array(); $sth2->finish(); if($anzahl == 0) {$comment_str = "Keine Kommentare";} elsif($anzahl == 1) {$comment_str = "1 Kommentar";} else {$comment_str = "$anzahl Kommentare";} my %posts = ( perm => $post_infos[0], head => $post_infos[2], date => $post_infos[3], user => $post_infos[4], comment_count => $comment_str, post => $post_infos[5] ); push(@posts,\%posts); } $sth->finish(); $dbh->disconnect; # ---------- Seitennavigation vorbereiten ---------- # my $newer = $page - 1; my $older = $page + 1; my $html_newer = "<a style=\"float:left;\" href=\"index.cgi?page=$newer\"> « zurück </a>"; my $html_older = "<a style=\"float:right;\" href=\"index.cgi?page=$older\"> nächste » </a>"; if ($newer < 0) { $html_newer = ""; } if ( ($older > $seiten - 1) || ($seiten == 1) ) { $html_older = ""; } ########################################################################################################################### # ----- Template Parameter ------ # $template->param( path => $config{'htmlpath'}, blogname => $blogname, posts => \@posts, zurueck => $html_newer, naechste => $html_older, box_list => \@boxes ); print $template->output(); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<title><TMPL_VAR NAME="blogname"></title>
<link rel="shortcut icon" type="image/x-icon" href="<TMPL_VAR NAME="path">/images/favicon.ico" />
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="path">/css/style.css" />
</head>
<body>
<div id="top"></div>
<!-- Header -->
<div id="header">
<!-- Blogname -->
<div id="blogname_box">
<p class="blogname"><TMPL_VAR NAME="blogname"></p>
</div>
</div>
<!-- Menubar -->
<div id="menu">
<a href="Test">TestPage</a>
<a href="Test2">TestPage2</a>
</div>
<!-- Main -->
<div id="main">
<!-- Content -->
<div id="content">
<TMPL_LOOP NAME="posts">
<div class="blog_box">
<div class="blog_box_head"><TMPL_VAR NAME="head"></div>
<div class="blog_box_info"><span class="blog_date"><TMPL_VAR NAME="date"></span><span class="blog_user"><TMPL_VAR NAME="user"></span> <span class="blog_comments"><a href="index.cgi?perm=<TMPL_VAR NAME="perm">"><TMPL_VAR NAME="comment_count"></a></span></div>
<div class="blog_post">
<TMPL_VAR NAME="post">
</div>
<div class="hr"></div>
</div>
</TMPL_LOOP>
<div class="pages"><TMPL_VAR NAME="zurueck"><TMPL_VAR NAME="naechste"></div>
</div>
<!-- Main2 -->
<div id="main2">
<!-- Search -->
<div id="search">
<form style="display:inline" action="" method="post">
<div><input style="width:100%;" type="text" name="search" value="Search ..." maxlength="40" onfocus="this.value=''" onblur="this.value='Search ...'" /></div>
</form>
</div>
<!-- Navi -->
<TMPL_LOOP NAME="box_list">
<div class="navi_box">
<fieldset>
<legend><TMPL_VAR NAME="box_name"></legend>
<TMPL_LOOP NAME="box_links">
<TMPL_VAR NAME="link">
</TMPL_LOOP>
</fieldset>
</div>
</TMPL_LOOP>
</div>
<div class="clear"></div>
</div>
<!-- Footer -->
<div id="footer">
</div>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--
-- Tabellenstruktur für Tabelle `navibox`
--
CREATE TABLE IF NOT EXISTS `navibox` (
`box_id` int(11) NOT NULL AUTO_INCREMENT,
`box_typ` varchar(30) NOT NULL,
PRIMARY KEY (`box_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Daten für Tabelle `navibox`
--
INSERT INTO `navibox` (`box_id`, `box_typ`) VALUES
(1, 'Kategorien'),
(2, 'Counter');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `navigation`
--
CREATE TABLE IF NOT EXISTS `navigation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`link_titel` varchar(200) NOT NULL,
`link` text NOT NULL,
`categorie` varchar(20) NOT NULL,
`box_typ` varchar(20) NOT NULL,
`option` varchar(20) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Daten für Tabelle `navigation`
--
INSERT INTO `navigation` (`id`, `link_titel`, `link`, `categorie`, `box_typ`, `option`, `content`) VALUES
(1, 'Google', 'http://www.google.de', '', 'Kategorien', 'link', ''),
(2, 'Youtube', 'http://www.youtube.de', '', 'Kategorien', 'link', '');
-- --------------------------------------------------------
Guest BobCode (perl): (dl )1 2 3 4 5 6#!/usr/bin/perl use strict; use warnings; use CGI; use CGI qw(:standart);
Guest BobCode (perl): (dl )1 2 3 4 5 6# ---------- Ip auf Blackliste überprüfen ---------- # my $dbh = DBI->connect("dbi:mysql:$config{'mysql_db'}:$config{'mysql_host'}","$config{'mysql_user'}","$config{'mysql_pass'}") || die("$DBI::errstr\n"); # ... # ---------- Settings lesen ---------- # my $dbh = DBI->connect("dbi:mysql:$config{'mysql_db'}:$config{'mysql_host'}","$config{'mysql_user'}","$config{'mysql_pass'}") || die("$DBI::errstr\n"); my $sth = $dbh->prepare("SELECT blogname,messages_per_page FROM settings") || die("$DBI::errstr\n");
Guest BobAm Anfang verwendest Du CGI Objektorientiert und jetzt auf einmal die Funktionen. Du kannst hier $cgi->param('page') statt CGI::param('page') schreiben.