-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlookup.php
52 lines (39 loc) · 1 KB
/
lookup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
<title><?php echo $_POST['base']; ?> METAR Output</title>
</head>
<body>
<?php
$db = mysql_connect("localhost", "root", "goofy");
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
$dbSelected = mysql_select_db("wxdb", $db);
if (! @mysql_select_db("wxdb") ) {
echo( "<p>Unable to locate the wxdb " .
"database at this time.</p>" );
exit();
}
$strBase = $_POST['base'];
$strBegindate = $_POST['begin'];
$strEnddate = $_POST['end'];
$dbQuery = "SELECT DISTINCT metar FROM metar WHERE metar like '$strBase%' and (date between $strBegindate and $strEnddate)";
$dbQueryResult = mysql_query($dbQuery, $db);
if (!$dbQueryResult) {
echo("<p>Error performing query: " . mysql_error() .
"</p>");
exit();
}
echo '<p>';
while ( $row = mysql_fetch_array($dbQueryResult) ) {
echo($row["metar"] .
"<br>");
}
echo '</p>';
?>
<p>Perform another <a href="wxdb.php">search</a>?</p>
<script src="../scripts/address2.js"></script>
</body>
</html>