develooper Front page | perl.beginners | Postings from January 2002

help with count query in mysql

Thread Next
From:
FLAHERTY, JIM-CONT
Date:
January 15, 2002 12:06
Subject:
help with count query in mysql
Message ID:
6D0317C617A8D3119EC000A0C9FC45240190A68F@KINX68322M1
How do you  do a count query in mysql ?  I have redhat 7.1 mysql 3.23   
 
code  
 
 
######################################################
#     get stats
######################################################
 
use DBI;
my $database = "VHD";
my $data_source = "DBI:mysql:$database";
my $username = "name";
my $password = "password";
 
$dbh =DBI ->connect($data_source, $username, $password);
my $sth1 = $dbh -> prepare("select count(*) from jobs where status =
'closed'");
$sth1 -> execute or die " unable to execute query ";
 

my $array_ref = $sth1 -> fetchall_arrayref();
  foreach $row(@$array_ref){
my($closedJ) = @$row;
# print LOG "$row";
print LOG "$closedj[0]";
 
}
$dbh -> disconnect;
 
 
 
thank you in advance
 
Jim F
 
 

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About