in reply to Getting a count of all rows in MySQL

Take a longer look at the DBI manual. You want one of these additional things after you do the "execute" call:
while ( my @row = $sth->fetchrow_array ) { print "@row\n" } # or while ( my $row_ref = $sth->fetchrow_arrayref ) { print "@$row\n" } # or my $allrows_ref = $sth->fetchall_arrayref; for my $row ( @$allrows_ref ) { print "@$row\n"; }
There are other useful methods for fetching the results of queries, all nicely documented in the manual.

Replies are listed 'Best First'.
Re^2: Getting a count of all rows in MySQL
by spmlingam (Scribe) on Dec 01, 2008 at 07:52 UTC
    my $data = qq[SELECT COUNT(*) FROM questions WHERE `q1` = "upright"]; my @results = $dbh->selectrow_array($data); print $results[1];
    you can use this.