Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. [![<?php
  2.  
  3. $servername = "localhost";
  4. $username = "venividivici2016";
  5. $password = "4XDjhDFsxBtbxRsw";
  6.  
  7. // Create connection
  8. $conn = mysqli_connect($servername, $username, $password);
  9.  
  10. // Check connection
  11. if (!$conn) {
  12. die("Connection failed: " . mysqli_connect_error());
  13. } else {
  14.  
  15.  
  16.  
  17. }
  18.  
  19.  
  20.  
  21. echo '<br/>';
  22.  
  23. $bd_seleccionada = mysqli_select_db($conn,"veniviajes");
  24. if (!$bd_seleccionada) {
  25. die("Conecion fallida: " . mysqli_error($conn));
  26. } else {
  27.  
  28.  
  29.  
  30. }
  31.  
  32. $sentencia= " SELECT nombre FROM pais";
  33. if(!$sentencia)
  34. die("Error: no se pudo realizar la consulta");
  35. $resultado = mysqli_query($conn,$sentencia);
  36. if(!$resultado)
  37. die("Error: no se pudo realizar la consulta");
  38.  
  39.  
  40.  
  41. ?>
  42.  
  43. <select>
  44.  
  45. <option value="">Seleccione</option>
  46.  
  47. <?php
  48.  
  49. while($fila=mysqli_fetch_array($resultado)){
  50.  
  51. ?>
  52.  
  53. <option value="<?php echo $fila[nombre]; ?></option>
  54.  
  55. <?php } ?>
  56.  
  57. </select>]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement