Counting countries
am 20.09.2004 14:33:32 von Bruce TherrienTrying to count the number of countries in a MySQL database.
Each client has a country entered, and we want to add the total
countries we are in and display on our site.
The following code is not working correctly.
Any help appreciated.....
$SQL =<
SQL
$sth = $dbh->prepare($SQL);
if(!$sth) { die("Error: " . $dbh->errstr . "\n"); }
if(!$sth->execute) { die("Error: " . $sth->errstr . "\n"); }
$match = 0;
if($sth->rows != 0)
{
$total_rows = $sth->rows;
$match = 1;
for ($counter = 0; $counter < $total_rows; $counter++)
{
my($ref) = $sth->fetchrow_hashref;
$totalcountries = $ref->{'total3'};
open(NUM,">$data_directory/country_count.txt");
flock (NUM, 2);
print NUM "$totalcountries";
close(NUM);
}
}
$sth->finish();
This is the end of the internet.
Please turn around and go back.
--
Bruce Therrien
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org