fetchrow_hashref working fine, but when i use fetchrow_array getting following Error.
#!/usr/bin/perl
use warnings;
use DBI;
$DB_name = 'database';
$DB_user = 'root';
$DB_pwd = '';
my $dsn = 'dbi:mysql:avm:localhost:3306';
$dbh = DBI->connect($dsn,"$DB_user","$DB_pwd");
print "\nConnection error: $DBI::errstr\n\n";
$sth = $dbh->prepare("SELECT * FROM tblmanufacturer");
$sth->execute();
while ( ($id,$name) = $sth->fetchrow_array() )
{
print "$id\t\t $name \n";
}
$sth->finish();
$dbh->disconnect();
DBD::mysql::st fetchrow_array failed: fetch() without execute() at
Check the return value of
execute()and/orprint "$DBI::errstr\n\n"and see if execute is failing.