Smitz#!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 music 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";
In reply to Re: MySQL count with DBI
by smitz
in thread MySQL count with DBI
by aenima
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |