HASH(0x8219c90) bei MySQL-Abfrage
Aquariophile
- perl
0 Calocybe
Hallo!
Untenstehendes Script gibt folgendes aus:
HASH(0x8219c90)
HASH(0x8219c30)
HASH(0x8219c90)
HASH(0x8219c30)
HASH(0x8219c90)
HASH(0x8219c30)
HASH(0x8219c90)
HASH(0x8219c30)
HASH(0x8219c90)
=============================================================
#!/usr/bin/perl
use DBI;
use strict;
use CGI;
use HTML::Template;
my $cgi = CGI->new();
print "Content-type: text/html\n\n";
my $dbh = DBI->connect('DBI:mysql:database=foobar;host=localhost', 'user', 'passwd');
my $sth = $dbh->prepare("SELECT vorname, nachname, telephon FROM tabelle WHERE vorname LIKE ?");
$sth->execute("%");
while (my $href = $sth->fetchrow_hashref("NAME_lc"))
{
print $href."<br>";
}
=============================================================
Danke für Hilfe!
Aquariophile
Hi!
while (my $href = $sth->fetchrow_hashref("NAME_lc"))
{
print $href."<br>";
}
Das was Dir fetchrow_hashref zurueckgibt ist eine Hash-Referenz, was angesichts des Namens der Funktion irgendwie auch naheliegend ist, oder? Willst Du jetzt wissen, wie man die Keys/Values eines Hashs ausgibt, oder was ist Deine Frage?
So long