Last active
January 16, 2017 04:08
-
-
Save welding3000/072d1673ef31765f9df9ea11f4320468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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