Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $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'];
- }
- else
- echo "didn't get it";
- //echo $state_name;
- $query = "Select DISTINCT state_name,county_name,s.fips,count,entries,category FROM SECountiesEntries s,Tennessee t WHERE s.fips=t.Fips and state_name='".$state_name."'";
- //echo $query;
- $result = mysql_query($query);
- if(!$result){
- die('Invalid query: ' .mysql_error());
- }
- ?>
- <select name="county" onchange="genusSelect(this.value)">
- <option value='SelectALL'>SelectALL</option>
- <?while($row=mysql_fetch_array($result)){?>
- <option value=<?=$row['county_name']?>><?=$row['county_name']?></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></tr>';*/
- while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
- {
- echo "<tr>";
- echo '<td>' . $row['state_name'] . '</td>';
- echo '<td>' . $row['county_name'] . '</td>';
- echo '<td>' . $row['fips'] . '</td>';
- echo '<td>' . $row['count'] . '</td>';
- echo '<td>' . $row['entries'] . '</td>';
- echo '<td>' . $row['category'] . '</td>';
- echo "</tr>";
- }
- echo "</table>";
- mysql_close($connection);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement