Last active
August 29, 2015 14:17
-
-
Save Dajicu/a4f4346889d05df7041f to your computer and use it in GitHub Desktop.
Listar campos de una base de datos php mysql
This file contains hidden or 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 | |
$servidor = "localhost"; | |
$usuario = "marcadores"; | |
$pass = "marcadores"; | |
$basedatos = "marcadores"; | |
echo "<table border=1><tr><td>Username</td><td>DNI</td><td>Nombre</td><td>Apellido</td><td>Email</td> | |
<td>Telefono</td><td>Direccion</td><td>Password</td><td>FechaNacimiento</td><td>Sexo</td></tr>"; | |
$conexion = mysql_connect($servidor,$usuario,$pass); | |
if (!$conexion){ | |
die ('No he podido conetar: '.mysql_error()); | |
} | |
mysql_select_db($basedatos,$conexion); | |
$peticion = mysql_query("SELECT * FROM Usuarios"); | |
while ($fila = mysql_fetch_array($peticion)){ | |
echo "<tr><td>".$fila['Username']."</td><td>".$fila['DNI']."</td><td>".$fila['Nombre']."</td><td>".$fila['Apellido']."</td><td>".$fila['Email']."</td><td>".$fila['Telefono']."</td><td>".$fila['Direccion']."</td><td>".$fila['Password']."</td><td>".$fila['FechaNacimiento']."</td><td>".$fila['Sexo']."</td></tr>"; | |
echo "<br />"; | |
} | |
mysql_close($conexion); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment