Hola Quisiera me expliquen como paginar este buscado lo intente de todo
Index.php
Código HTML :
<form class="escribeform" action="B.php" method="get"> <input type="search" class="form-control" name="q" id="q" placeholder="Buscar"/> <button class="btn btn-danger" type="submit" name="b" value="Buscar">Go!</button> </form>
B.php-----(Parte que Muestra Los datos)
Código PHP :
<?php
// Incluimos la configuracion y conexion a la MySQL.
include('config.php');
$msg = "";
$b = "";
// Si se apreta el boton Agendar, da la condicion como true.
if(isset($_GET['b']) == TRUE)
{
// Verificamos que no alla ningun dato sin rellenar.
if(!empty($_GET['q']))
{
$nombre = htmlentities($_GET['q']);
$sql = "SELECT * FROM personas WHERE nombre LIKE '%".$nombre."%'";
$query = mysql_query($sql,$link);
// Mostramos un mensaje diciendo que todo salio como lo esperado
$msg = "Resultados para el nombre ".$nombre;
} else {
// Si hay un dato sin rellenar mostramos el siguiente texto.
$msg = "Falta rellenar algun dato";
}
}
?>
<html>
<head>
<title>Buscador</title>
</head>
<body>
<center><em><span style="color:red;"><?=$msg;?></span></em></center><br />
<center><form action="B.php" method="get">
<input type="text" name="q" id="q" />
<input type="submit" name="b" value="Buscar" />
</form></center><br />
<?php if($_GET['b'] && !empty($_GET['q'])){ ?>
<table width="100%" border="1">
<?php while($row = mysql_fetch_assoc($query)){ ?>
<tr>
<td>
<a href="ver.php?id=<?=$row['id']?>"><?=$row['nombre']?></a>
</td>
</tr>
<?php } ?>
</table>
<?php } ?>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
