My first PHP page
";
$mysql_id = mysql_connect('192.168.1.107', 'peter', 'Peter_Th');
mysql_select_db('test_ais', $mysql_id);
if(! $mysql_id )
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$sql = 'SELECT mmsi, shipname, callsign FROM message_5';
$result = mysql_query( $sql, $mysql_id );
if(! $result )
{
die('Could not get data: ' . mysql_error());
}
$kml = array('');
$kml[] = '';
$kml[] = ' ';
$kml[] = ' ';
$kml[] = ' ';
// End XML file
$kml[] = ' ';
$kml[] = '';
$kmlOutput = join("\n", $kml);
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmlOutput;
echo "Fetched data successfully\n";
mysql_close($mysql_id);
?>