Advertisement
Guest User

m3n

a guest
Dec 18th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. $host_db="localhost:3307";
  4. $user="root";
  5. $password="usbw";
  6. $db="desarrolloweb";
  7. if (!($conexion = mysql_connect($host_db, $user, $password)))
  8. die(mysql_error());
  9.  
  10. if (!mysql_select_db($db, $conexion))
  11. die(mysql_error());
  12. ?>
  13.  
  14.  
  15.  
  16. ------------------------
  17.  
  18.  
  19. <?php
  20.  
  21. include("conexion.php");
  22.  
  23. $result =mysql_query('SELECT * FROM persona',$conexion);
  24. if (!$result) {
  25. die ('Error en la query o no hay datos:'.mysql_error());
  26. }
  27. $lineas=mysql_num_rows($result);
  28. echo "Numero lineas:=".$lineas."<br>";
  29. echo "-----Fetch Array-----<br/>";
  30.  
  31.  
  32. while ($row = mysql_fetch_array($result))
  33. {
  34. // print_r($row);
  35. echo "<br/>";
  36. echo "------------------------<br/>";
  37. printf("Rut: %s ".
  38. "Nombre: %s".
  39. "Apellido Paterno: %s".
  40. "Apellido Materno: %s <br/>",
  41. $row['Rut'], $row['Nombre'],
  42. $row['ApellidoPat'],$row['ApellidoMat']);
  43. echo "<br/>";
  44.  
  45. }
  46. mysql_close($conexion);
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement