If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
You can just loop through the results, printing and/or counting them.
This is an example using 'selectall_hashref':
Code:
$sth = $dbh->prepare('SELECT * FROM exmpl_tbl');
$results = $dbh->selectall_hashref('SELECT * FROM exmpl_tbl', 'id');
foreach my $id (keys %$results) {
print "Value of ID $id is $results->{$id}->{val}\n";
}
This is different example using 'selectall_arrayref':
Code:
my $sql_stmnt = "SELECT * FROM emp WHERE emp_id = ?";
my $emps = $dbh->selectall_arrayref($sql_stmnt, undef, '1234');
foreach my $emp (@$emps) {
my ($emp_id, $emp_name) = @$emps;
print "$emp_id - $emp_name \n";
}