Guest User

Untitled

a guest
Apr 1st, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. [insert_php]
  2.  
  3. $servername = "sql102.*******.com";
  4. $username = "b3_*******";
  5. $password = "********";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password);
  9.  
  10. // Check connection
  11. if ($conn->connect_error)
  12. {
  13. die("Connection failed: " . $conn->connect_error);
  14. }
  15. echo "Connected successfully";
  16.  
  17. mysqli_select_db('b3_**********');
  18.  
  19. $sql="SELECT City FROM Map_of_resellers";
  20.  
  21. $result=mysqli_query($sql);
  22.  
  23.  
  24. if($result === FALSE)
  25. {
  26. die("Query failed: " . mysqli_error());
  27. }
  28.  
  29. [/insert_php]
  30.  
  31.  
  32. <form name="Cities" method="post" >
  33.  
  34. [insert_php]
  35.  
  36. echo "<select name='City'>";
  37.  
  38.  
  39. while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
  40. {
  41. echo "<option value='" . $row['City'] ."'>" .
  42. $row['City']."</option>";
  43. }
  44.  
  45. echo "</select>";
  46.  
  47. [/insert_php]
  48.  
  49. </form>
Add Comment
Please, Sign In to add comment