[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: Query problem in Perl
From: "Almar van Pel" <a.vanpel () chello ! nl>
Date: 2002-08-31 19:23:47
[Download RAW message or body]
Hello,
I was trying to create a simple perl program, where my domains where listed
followed by there DNS records.
But It loops once, and then ends with error DBD::mysql::st fetch failed:
fetch() without execute() at test.cgi line 61.
I thougt this was the easyest way to do so. But no.. Does anyone have any
experience with these kind of sub-statements?
$dbh = DBI->connect("DBI:mysql:database=$db_database;host=$db_host",
$db_user, $db_pw) ||
&db_error("Databaseverbinding niet gemaakt: $DBI::errstr");
$sql = "select domain from bind_dns_header";
$sth = $dbh->prepare($sql)|| &error("Kan het statement niet voorbereiden:
$dbh->errstr");
$sth->execute || &error("Fout bij het communiceren met de database:
$DBI::errstr");
$sth->bind_columns(\$domain);
while ($sth->fetch()) { # line 61
print "$domain with the following records<br> \n";
$sql2 = "select dnsrecord_id from bind_dns_item where domain =
'$domain'";
$sth = $dbh->prepare($sql2)|| &error("Kan het statement niet voorbereiden:
$dbh->errstr");
$sth->execute || &error("Fout bij het communiceren met de database:
$DBI::errstr");
$sth->bind_columns(\$dnsrecord_id);
while ($sth->fetch()) {
print "Record: $dnsrecord_id \n";
}
}
$sth->finish();
Regards,
Almar
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread118495@lists.mysql.com>
To unsubscribe, e-mail <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic