/ Published in: PHP

By using this snippet we can recover fields from a database by filtering these ones per a specific field.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $twitter=$_POST['twitter']; $encontrado=false; $servidor="localhost"; $usuario="root"; $pass=""; $base_datos="db_amigos"; $encontrado=true; "<h1>Los datos de $twitter son los siguientes:</h1> <br />"; 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 "</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 "</tr> \n"; } if(!encontrado){ echo"No tienes ningún amigo con el usuario".$twitter; } }//while }else { echo "¡ La base de datos está vacia !"; } ?>
Comments
