"; } ?> (UNIX_TIMESTAMP() - 900) GROUP BY src_ip"; $iplist = mysqli_query($conn1, $query1); echo "

Locations of the Unique Source IP addresses for incoming traffic on Port $varPort from the last 15 minutes

"; //Initialize your first couple variables $encodedString = ""; //This is the string that will hold all your location data $x = 0; //This is a trigger to keep the string tidy //Multiple rows are returned while ($row = mysqli_fetch_array($iplist)) { $ip = $row['src_ip']; $location = $geoip->lookupLocation($ip); //This is to keep an empty first or last line from forming, when the string is split if ( $x == 0 ) { $separator = ""; } else { //Each row in the database is separated in the string by four *'s $separator = "****"; } //Saving to the String, each variable is separated by three &'s $encodedString = $encodedString.$separator. "

IP: ".$row['src_ip']. "
Lat: ".$location->latitude. "
Long: ".$location->longitude. "

&&&".$location->latitude."&&&".$location->longitude; $x = $x + 1; } $conn1->close(); ?>