Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 9 — Using Overlays 175


}
elsif(param(‘m’) eq ‘getmarkers’)
{
getmarkers(param(‘city’));
}


sub citylist
{
my $sth = $dbh->prepare(‘select distinct(city) from ch09_cplx’);
$sth->execute();


print “”;
while (my $row = $sth->fetchrow_hashref())
{
printf(‘>’,$row->{city});
}
print “
”;
}


sub getmarkers
{
my ($city) = @_;


print(“<markers>\n”);

my $sth = $dbh->prepare(sprintf(‘select * from ch09_cplx where city = %s’,
$dbh->quote($city)));
$sth->execute();

while (my $row = $sth->fetchrow_hashref())
{
printf(‘ ;


%s
%s
%\
s
%s%s
’,
$row->{lat},
$row->{lng},
$row->{title},
$row->{title},
$row->{street},
$row->{city},
$row->{postcode},
$row->{phone},
);
}
$sth->finish();

print(“\n”);
}

Free download pdf