Leser: 1
|< 1 2 >| | 11 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
# --------------------------------------------------------
#
# Table structure for table 'template'
#
CREATE TABLE template (
id int(255) NOT NULL auto_increment,
name varchar(255) NOT NULL,
titel varchar(255) NOT NULL,
template text NOT NULL,
PRIMARY KEY (id)
);
SELECT * FROM tabelle WHERE spalte1='trallala' AND spalte2='hollido' AND NOT spalte2='';
SELECT * FROM tabelle1 AS t1, tabelle2 AS t2, tabelle3 AS t3 WHERE t1.spalte1='trallala' AND t2.spalte1='haumichblau' AND NOT t3.anderespalte='nixda';
SELECT * FROM templates WHERE name = 'template1' OR name = 'template2';
1
2
3
4
5
6
7
8
my $vnav_template = [];
push @{ $vnav_template }, main::get_template_bn('vnav_head');
push @{ $vnav_template }, main::get_template_bn('vnav_item');
push @{ $vnav_template }, main::get_template_bn('vnav_foot');
my $hnav_template = [];
push @{ $hnav_template }, main::get_template_bn('hnav_head');
push @{ $hnav_template }, main::get_template_bn('hnav_item');
push @{ $hnav_template }, main::get_template_bn('hnav_foot');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sub get_template_bn {
my $seitenname = shift;
my $returnvalue = undef;
{ # cmd
my $cmd = "SELECT template FROM template WHERE name='$seitenname'";
my $sth = $dbh->prepare($cmd) || die $dbh->errstr;
if( my $rv = $sth->execute ){
$returnvalue = join"",@{$sth->fetchrow_arrayref()};
$sth->finish();
}else{
die "Konnte \"$seitenname\" nicht aus seiten-Datenbank lesen: " . $dbh->errstr;
}
} # /cmd
return $returnvalue;
} # get_Template_bn
1
2
3
4
5
6
7
8
9
10
11
12
my @seiten= qw/vnav_head vnav_item vnav_foot hnav_head hnav_item hnav_foot/;
@seiten = join ',', map {$_ = "'$_'";} @seiten;
my $sql = qq!
SELECT template FROM template WHERE name IN(@seiten)
!;
my $sth = $dbh->prepare($sql) or die DBI::errstr;
$sth->execute or die DBI::errstr;
while ((my $template) = $sth->fetchrow_array()) {
print $template,"\n";
}
$sth->finish();
$dbh->disconnect();
|< 1 2 >| | 11 Einträge, 2 Seiten |