Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. $hostname = 'hostname';
  4. $dbname = 'dbname';
  5. $username = 'username';
  6. $password = 'password';
  7.  
  8. $con=mysql_connect($hostname,$username,$password,$dbname) or die("Failed to connect to MySQL: " . mysql_error());
  9. $db=mysql_select_db($dbname,$con) or die("Failed to connect to MySQL: " . mysql_error());
  10.  
  11.  
  12. $query = "SELECT * FROM `Treatments`";
  13.  
  14. $result = mysql_query($query, $con);
  15. $options = "";
  16.  
  17. if (!$result){
  18. die("No results found.");
  19. }
  20.  
  21. while ($row = mysql_fetch_array($result)){
  22. $options .= "<option>$row[1]</option>";
  23. }
  24.  
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement