http://qs1969.pair.com?node_id=256833


in reply to MySQL count with DBI

Yeah I had an idea once, a combination Hat and Shoe, but the backers dropped out and I
lost EVERYTHING. Anyway, does this answer your non-question?
#!perl -w use strict; use DBI; my $dbh = DBI->connect('DBI:mysql:my_database', 'my_username', 'my_pas +sword') or die "Couldn't open database: $DBI::errstr; stopped"; # Prepare the SQL query for execution my $sth = $dbh->prepare(<<SQL) or die "Couldn't prepare statement: $DB +I::errstr; stopped"; SELECT COUNT(*) FROM table SQL # Execute the query $sth->execute() or die "Couldn't execute statement: $DBI::errstr; stop +ped"; #print result my ($count) = $sth->fetchrow_array(); print "Found $count results\n";
Smitz

Yeah I copied and pasted from stephens excellent Reading from a database. Sorry, stephen