in reply to printing records in MySQL
However, it's quite possible to do it with DBI and a loop. The DBI bind_columns() method is the fastest fetching method and gives you nice variable names without even creating a hash. Here's an example:
my $sth=$dbh->prepare("SELECT country,region FROM geo"); $sth->execute; my($country,$region); $sth->bind_columns(\$country,\$region); while ($sth->fetch) { print "<tr><td>$country</td><td>$region</td></tr>\n"; }
|
|---|