Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html
<meta charset="utf-8">
// Abrir conexión
$conexion = new mysqli("localhost", "root", "", "tutoriales");
// Guardar consulta en variable $query
$query = "SELECT * FROM usuarios";
// Mandar consulta a MySQL
// Guardar resultados en variable $resultados
$resultados = $conexion->query($query);
// Mostrar resultados
while ($resultado = $resultados->fetch_array()) {
<h1><?php echo $resultado["nombre"]; ?></h1>
if (isset($_GET["q"])) {
echo $_GET["q"];
} else {
// No hacer nada
<form action="form.php.php" method="get">
<input type="text" name="q"><br>
<input type="submit" value="Buscar">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment