Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1.  <?php
  2. $connection = mysql_connect('localhost',"sernec","sernec");
  3. if(!$connection){ die('Not connected : '.mysql_error()); }
  4.  
  5. $db_selected = mysql_select_db("SERNEC",$connection);
  6. if(!$db_selected){  die('Cant use db: '.mysql_error()); }
  7.  
  8. if (isset($_GET["state"])) {
  9.     $state_name =  mysql_real_escape_string ($_GET["state"]);
  10.    //echo $_GET['state'];
  11. }
  12. else
  13. echo "didn't get it";
  14. //echo $state_name;
  15.  
  16. $query = "Select DISTINCT state_name,county_name,fips,count,entries,category FROM SECountiesEntries WHERE state_name='".$state_name."'";
  17. //echo $query;
  18. $result = mysql_query($query);
  19. if(!$result){
  20. die('Invalid query: ' .mysql_error());
  21. }
  22. ?>
  23.  
  24. <select name="county" onchange="genusSelect(this.value)">
  25. <option>Select All</option>
  26. <option> Select County </option>
  27. <?while($row=mysql_fetch_array($result)){?>
  28. <option value=<?=$row['county_name']?>><?=$row['county_name']?></option>
  29. <?}?>
  30. </select>
  31.  
  32. <?php
  33. echo "<table border='1'>";
  34. /*echo '<tr><th>StateName</th><th>CountyName</th><th>Fips</th><th>Count</th><th>Entries</th><th>Category</th></tr>';*/
  35. while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
  36. {
  37. echo "<tr>";
  38. echo '<td>' .  $row['state_name'] . '</td>';
  39. echo '<td>' .  $row['county_name'] . '</td>';
  40. echo '<td>' .  $row['fips'] . '</td>';
  41. echo '<td>' .  $row['count'] . '</td>';
  42. echo '<td>' .  $row['entries'] . '</td>';
  43. echo '<td>' .  $row['category'] . '</td>';
  44. echo "</tr>";
  45. }
  46. echo "</table>";
  47. mysql_close($connection);
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement