![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
Código PHP:
include("conec.php");
$link=conectarse();
$buscador = "";
if ($_GET['buscador']!=""){
$a=$_GET['buscador'];//guardamos la palabra que se buscara, viene de un formuliario anterior
}
//Limito la busqueda
$TAMANO_PAGINA = 10;
//examino la página a mostrar y el inicio del registro a mostrar
$pagina = $_GET["pagina"];
if (!$pagina) {
$inicio = 0;
$pagina=1;
}
else {
$inicio = ($pagina - 1) * $TAMANO_PAGINA;
}
if ($a !="")
{
$resultado=mysql_query("select estado, estacion, longitud, latitud, direccion from region where estatus='Operativa' and estado like '%".$_GET['buscador']."%' or estacion like '%".$_GET['buscador']."%' or longitud like '%".$_GET['buscador']."%' or latitud like '%".$_GET['buscador']."%' or direccion like '%".$_GET['buscador']."%'",$link);//consulta a la tabla region
$contador=mysql_num_rows($resultado);
$resultado2=mysql_query("select estado, estacion, tipo_estacion, estatus_cabina, estatus_vigilancia from region where estatus='Operativa' and estado like '%".$_GET['buscador']."%' or tipo_estacion like '%".$_GET['buscador']."%' or estatus_cabina like '%".$_GET['buscador']."%' or estatus_vigilancia like '%".$_GET['buscador']."%'", $link);//consulta a tabla region con filtro diferente
$contador2=mysql_num_rows($resultado2);
$resultado7=mysql_query("select sectores, arfcn, bsic, ant_direction, antena from sectores where sectores like '%".$_GET['buscador']."%' or arfcn like '%".$_GET['buscador']."%' or bsic like '%".$_GET['buscador']."%' or ant_direction like '%".$_GET['buscador']."%' or antena like '%".$_GET['buscador']."%'",$link);
$contador7=mysql_num_rows($resultado7);//consulta a tabla distinta
$num_total_registros= $contador+$contador2+$contador7;
$total_paginas = ceil($num_total_registros / $TAMANO_PAGINA);
echo "Número de registros encontrados: " . $num_total_registros . "<br>";
echo "Se muestran páginas de " . $TAMANO_PAGINA . " registros cada una<br>";
echo "Mostrando la página " . $pagina . " de " . $total_paginas . "<p>";
//AHORA HAGO LA CONSULTA CON EL LIMIT PARA LA PAGINACIÓN
$resultado14=mysql_query("select estado, estacion, longitud, latitud, direccion from region where estatus='Operativa' and estado like '%".$_GET['buscador']."%' or estacion like '%".$_GET['buscador']."%' or longitud like '%".$_GET['buscador']."%' or latitud like '%".$_GET['buscador']."%' or direccion like '%".$_GET['buscador']."%' limit ". $inicio . "," . $TAMANO_PAGINA . "",$link);//MISMA CONSULTA DE ARRIBA CON EL LIMIT
$contador14=mysql_num_rows($resultado14);
$resultado15=mysql_query("select estado, estacion, tipo_estacion, estatus_cabina, estatus_vigilancia from region where estatus='Operativa' and estado like '%".$_GET['buscador']."%' or tipo_estacion like '%".$_GET['buscador']."%' or estatus_cabina like '%".$_GET['buscador']."%' or estatus_vigilancia like '%".$_GET['buscador']."%' limit ". $inicio . "," . $TAMANO_PAGINA . "", $link);//MISMA CONSULTA DE ARRIBA CON EL LIMIT
$contador15=mysql_num_rows($resultado15);
$resultado20=mysql_query("select sectores, arfcn, bsic, ant_direction, antena from sectores where sectores like '%".$_GET['buscador']."%' or arfcn like '%".$_GET['buscador']."%' or bsic like '%".$_GET['buscador']."%' or ant_direction like '%".$_GET['buscador']."%' or antena like '%".$_GET['buscador']."%' limit ". $inicio . "," . $TAMANO_PAGINA . "",$link);//MISMA CONSULTA DE ARRIBA CON EL LIMIT
$contador20=mysql_num_rows($resultado20);
if (($contador14 !=0) or ($contador15 !=0) or ($contador20 !=0))
{
while ($row=mysql_fetch_array($resultado14))
{
echo "<br>";
echo '<table width="700" border="1" align="center" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<th width="100"> Estado</th>';
echo '<th width="150"> Estación </th>';
echo '<th width="100"> Longitud </th>';
echo '<th width="100"> Latitud </th>';
echo '<th width="250"> Direccion </th>';
echo '</tr>';
echo "<tr>";
echo "<td width='100' height='40'>".$row['estado']."</td>";
echo "<td width='150' height='40'>".$row['estacion']."</td>";
echo "<td width='100' height='40'>".$row['longitud']."</td>";
echo "<td width='100' height='40'>".$row['latitud']."</td>";
echo "<td width='250' height='40'>".$row['direccion']."</td>";
echo "</tr>";
echo "<table>";
echo "<br>";
echo "<br>";
}//fin del while
mysql_free_result($resultado14);
while ($row2=mysql_fetch_array($resultado15))
{
echo "<br>";
echo '<table width="700" border="1" align="center" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<th width="100"> Estado </th>';
echo '<th width="150"> Estación </th>';
echo '<th width="150"> Tipo de Estación </th>';
echo '<th width="150"> Estátus Cabina </th>';
echo '<th width="150"> Estátus Vigilancia </th>';
echo '</tr>';
echo "<tr>";
echo "<td width='100' height='40'>".$row2['estado']."</td>";
echo "<td width='150' height='40'>".$row2['estacion']."</td>";
echo "<td width='150' height='40'>".$row2['tipo_estacion']."</td>";
echo "<td width='150' height='40'>".$row2['estatus_cabina']."</td>";
echo "<td width='150' height='40'>".$row2['estatus_vigilancia']."</td>";
echo "</tr>";
echo "<table>";
echo "<br>";
echo "<br>";
}//fin del while
mysql_free_result($resultado15);
while ($row7=mysql_fetch_array($resultado20))
{
echo "<br>";
echo '<table width="700" border="1" align="center" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<th width="200"> Sectores </th>';
echo '<th width="100"> ARFCN </th>';
echo '<th width="100"> BSIC </th>';
echo '<th width="200"> Orientacion de la Antena </th>';
echo '<th width="100"> Antena </th>';
echo '</tr>';
print ("<tr>");
print ("<td width='200' height='40'>$row7[0]</td>");
print ("<td width='100' height='40'>$row7[1]</td>");
print ("<td width='100' height='40'>$row7[2]</td>");
print ("<td width='200' height='40'>$row7[3]</td>");
print ("<td width='100' height='40'>$row7[4]</td>");
print ("</tr>");
print ("<table>");
print ("<br>");
}//fin del while
mysql_free_result($resultado20);
//MUESTRO EL INDICE DE LAS PAGINAS
if ($total_paginas > 1){
for ($i=1;$i<=$total_paginas;$i++){
if ($pagina == $i)
//si muestro el índice de la página actual, no coloco enlace
echo $pagina . " ";
else
//si el índice no corresponde con la página mostrada actualmente, coloco el enlace para ir a esa página
echo "<a href='buscador.php?pagina=" . $i . "&buscador=" . $a . "' class='estilo2'>" . $i . "</a> ";
}
}
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
Y gracias por adelantado.....