connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } if (!$_GET['id']) { } else { $id = $_GET['id']; $products = array(); if ($result = mysqli_query($db, "SELECT product, astext(poly) FROM products WHERE eventTrackingNumber = '$id'")) { while($row = $result->fetch_array()) { $products[] = $row['product']; $product = $row['product']; $poly = $row['astext(poly)']; $poly = substr($poly, 9, -2); $poly = str_replace(',', '|', $poly); $poly = str_replace(' ', ',', $poly); $mapURL = "https://maps.googleapis.com/maps/api/staticmap?size=400x450&path=color:0x00000000|weight:5|fillcolor:0xFFFF0033|" . $poly; $metaIMG = "https://maps.googleapis.com/maps/api/staticmap?size=280x150&path=color:0x00000000|weight:5|fillcolor:0xFFFF0033|" . $poly; $poly = $row['astext(poly)']; $poly = substr($poly, 9, -2); $mapCoords = $poly; $mapsPolygon = ""; $mapCoords = explode(",", $mapCoords); foreach ($mapCoords as $item) { $item = str_replace(" ", ", lng: ", $item); $item = "{lat: $item},"; $mapsPolygon = $mapsPolygon . $item; } $mapsPolygon = substr($mapsPolygon, 0, -1); } //FIND THE counties preg_match("/FOR\.\.\.(.*?)\*/s", $product, $counties); $counties = $counties[1]; $counties = explode("...", $counties); foreach ($counties as $county) { $county = explode('IN', $county); $county = $county[0]; $countyList = $countyList . "$county "; } //FIND THE EXPIRATION preg_match("#UNTIL (.*?)$#m", $product, $lexpire); $expire = $lexpire[1]; //FIND THE TYPE $type = substr($id, 8, -4); if ($type == "SV") { $type = "Severe Thunderstorm Warning"; } elseif ($type == "TO") { $type = "Tornado Warning"; } $desc = "$type for $countyList until $expire"; $title = "$type for $countyList"; } } ?>
$product) { if ($key === $count) { echo "
$product
"; } else { echo "
$product
"; } } ?>
.