Revision: 33940
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 15, 2010 02:15 by juanchifc
Initial Code
<?php
$servidor="localhost";
$usuario="root";
$pass="";
$base_datos="db_amigos";
$link=mysql_connect($servidor, $usuario, $pass);
mysql_select_db("db_amigos", $link);
$result = mysql_query("SELECT nombre, movil, mail, twitter FROM amigos", $link);
if ($row = mysql_fetch_array($result)){
echo "<table border = '1'> \n";
echo "<tr> \n";
echo "<td><b>Nombre</b></td> \n";
echo "<td><b>Móvil</b></td> \n";
echo "<td><b>Mail</b></td> \n";
echo "<td><b>Twitter</b></td> \n";
echo "</tr> \n";
do {
echo "<tr> \n";
echo "<td>".$row["nombre"]."</td> \n";
echo "<td>".$row["movil"]."</td>\n";
echo "<td>".$row["mail"]."</td> \n";
echo "<td>".$row["twitter"]."</td>\n";
echo "</tr> \n";
} while ($row = mysql_fetch_array($result));
echo "</table> \n";
} else {
echo "¡ La base de datos está vacia !";
}
?>
Initial URL
Initial Description
By using this snippnet we can recover and show on a table the items stored into a sql database managed with mysql.
Initial Title
Recover fields from a database
Initial Tags
mysql, database, sql, php
Initial Language
PHP