Skip to content

Instantly share code, notes, and snippets.

@welding3000
Last active January 16, 2017 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save welding3000/072d1673ef31765f9df9ea11f4320468 to your computer and use it in GitHub Desktop.
Save welding3000/072d1673ef31765f9df9ea11f4320468 to your computer and use it in GitHub Desktop.
<html>
<body>
<?php
$db_host = ”databases.000webhost.com”;
$db_nombre = “id550347_welding3300”;
$db_contra = “ ”;
$conexion = mysqli_connect($db_host,$db_usuario,$db_contra);
if(mysqli_connect_errno()){
echo " Error con la base de datos ";
exit();
}
mysqli_select_db($conexion, $db_nombre) or die ("no se encuentra la BBDD");
mysqli_set_charset($conexion,"utf8");
$consulta = " SELECT * FROM `DATOSPERSONALES`";
$resultados = mysqli_query($conexion, $consulta);
while($fila=mysqli_fetch_row($resultados)){
echo $fila[0] . " ";
echo $fila[1] . " ";
echo $fila[2] . " ";
echo $fila[3] . " ";
echo "<br>";
}
mysqli_close($conexion);
?>
</body>
</html>
<?php
error_reporting(0);
//Local host
$host =" localhost "; // Host name
$username =" id550347_test "; // Mysql username
$password =" test123 "; // Mysql password
$db_name =" id550347_test "; // Database name
/**
* Holds the reference to
* Use this global for queries
* @global mysqli $query
*/
$GLOBALS['query'] = new mysqli($host, $username, $password, $db_name) or die("cannot connect");
global $query;
if ($query->connect_errno) {
printf("Connect failed: %s\n", $query->connect_error);
exit();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment