topical media & game development
mashup-gmaps-ch11-03.cgi / cgi
#!/usr/bin/perl
use DBI;
use strict;
use CGI qw/:standard/;
print header(-type => 'text/xml');
my dbh))
{
die "Couldn't open connection to database\n";
}
if (param('m') eq 'entitylist')
{
entitylist();
}
elsif(param('m') eq 'getmarkers')
{
getmarkers(param('entity'));
}
sub entitylist
{
my dbh->prepare('select distinct(type) from ch10');
row = row->{type}));
}
print "</types>";
}
sub getmarkers
{
my (sth = dbh->quote(sth->execute();
while (my sth->fetchrow_hashref())
{
printf('<marker lat="\%f" lng="\%f" title="\%s"><infowindow><title>\%s</title><address>\%s</address><city>\%s</city><phone>\%s</phone></infowindow></marker>',
row->{lng},
row->{title},
row->{addb},
sth->finish();
print("</markers>\n");
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.