Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting ( E_ALL );
- $connection = mysql_connect('localhost',"sernec","sernec");
- if(!$connection){ die('Not connected : '.mysql_error()); }
- $db_selected = mysql_select_db("SERNEC",$connection);
- if(!$db_selected){ die('Cant use db: '.mysql_error()); }
- if (isset($_GET["state"])) {
- $state_name = mysql_real_escape_string ($_GET["state"]);
- // echo $_GET['state'];
- }
- if(isset($_GET["county"])){
- $county_name=mysql_real_escape_string ($_GET["county"]);
- //echo $_GET['county']
- }
- else
- echo "didn't get it";
- //echo $state_name;
- if( isset($_GET["county"])=="SelectALL"){
- $query = "Select DISTINCT Genus FROM Tennessee WHERE State='".$state_name."'";
- }
- $query = "Select DISTINCT Genus FROM Tennessee WHERE State='".$state_name."' AND County='".$county_name."'";
- echo $query;
- $result = mysql_query($query);
- //var_dump($result);
- //echo $result;
- if(!$result){
- die('Invalid query: ' .mysql_error());
- }
- ?>
- <select name="genus" onChange="display(this.value)">
- <option> Select Genus</option>
- <?while($row=mysql_fetch_array($result)){?>
- <option><?=$row['Genus']?></option>
- <?}?>
- </select>
- <?php
- echo "<table border='1'>";
- /*echo '<tr><th>StateName</th><th>CountyName</th><th>Fips</th><th>Count</th><th>Entries</th><th>Category</th><th>ID1</th><th>ID</th><th>Family</th><th>Genus</th><th>Sp$
- while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
- {
- echo "<tr>";
- echo '<td>' . $row['ID1'] . '</td>';
- echo '<td>' . $row['ID'] . '</td>';
- echo '<td>' . $row['Family'] . '</td>';
- echo '<td>' . $row['Genus'] . '</td>';
- echo '<td>' . $row['Species'] . '</td>';
- echo '<td>' . $row['ScientificNameAuthor'] . '</td>';
- echo '<td>' . $row['Subspecies'] . '</td>';
- echo "</tr>";
- }
- echo "</table>";
- mysql_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement