This tutorial here is a good source of generating kml from the database using php... http://code.google.com/apis/kml/articles/phpmysqlkml.html
However my problem is that when the script is ran, the file that is generated is saved as .php, not as .kml. How can I make it to be as .kml? Below is the specific code. Thanks!
<?php $kml = array('<?xml version="1.0" encoding="UTF-8"?>'); $kml = '<kml xmlns="http://www.opengis.net/kml/2.2">'; $kml = '<Document>'; $kml = '</Document>'; $kml = '</kml>'; $kmlOutput = join("\n", $kml); header('Content-type: application/vnd.google-earth.kml+xml'); echo $kmlOutput; ?>