This parses data from the MySQL database. The MySQL database receives data from the python balloon server, using jQuery, jQuery maps, and the google maps API. — Brad Luyster 2010/10/07 17:48

track.php
<STYLE TYPE="text/css">
        #map { width: 400px; height: 400px; margin: auto }
</STYLE>
 
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=USEYOUROWNKEY" type="text/javascript"></script>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery.gmap-1.1.0-min.js"></script>
<?
mysql_connect(localhost,"user","pass");
@mysql_select_db("lvl1balloon") or die("Unable to Select db");
$sql = "SELECT * FROM `table`";
$result = mysql_query($sql);
 
$i = 0;
 
while($row = mysql_fetch_assoc($result)) {
 
        $data[$i][0] = $row["Sample Number"];
        $data[$i][1] = $row["Latitude"];
        $data[$i][2] = $row["Longitude"];
        $data[$i][3] = $row["Satellites"];
        $data[$i][4] = $row["alt"];
        $data[$i][5] = $row["itemp"];
        $data[$i][6] = $row["otemp"];
        $i++;
}
 
mysql_free_result($result);
 
$j = 0;
foreach ($data as $value) {
        $mark[$j] = "latitude: ".$value[1].",\nlongitude: ".$value[2].",\nhtml: \"Sample: ".$value[0]."<br/>Satellites: ".$value[3]."<br/>Altitude: " .$value[4]."<br/>Internal Temperature: ".$value[5]."<br/>External Temperature: " . $value[6]. "\"";
        $j++;
}
 
 
?>
<script type="text/javascript">
$(document).ready(function() {
        $("#map").gMap({ markers: [ <? foreach($mark as $value) {
                                        print " { $value }, \n";}?> ],
                        zoom:14 } );
});
</script>
 
<div id="map"></div>
launches/highball/phptracker.txt · Last modified: 2010/10/07 21:56 by bradluyster
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki