/ Published in: PHP

By using this snippnet we can recover and show on a table the items stored into a sql database managed with mysql.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $servidor="localhost"; $usuario="root"; $pass=""; $base_datos="db_amigos"; 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"; echo "</table> \n"; } else { echo "¡ La base de datos está vacia !"; } ?>
Comments
