<?php
include("conexion.php");
if($_REQUEST["btnBuscar"]!="" && $_REQUEST["busqueda"]!="")
{
$filtro="id=". $_REQUEST["busqueda"];
else
$filtro=" apepat like '%".$_REQUEST["busqueda"]."%' or apemat like '%".$_REQUEST["busqueda"]."%' or nombre like '%". $_REQUEST["busqueda"]."%'";
$mensaje=$filtro;
}else
{
$mensaje="<font color='red'>Escriba Algo</font>";
}
$rst_clientes=mysql_query("select * from cliente",$conexion);//ME PARECE QUE ACA DEBO DE PONER UN WHERE PERO NO SE COMO LO DEBO DE PONER PORQUE LO ESTOY FILTRANDO CON EL FILTRO
if($num_registros==0)
{
echo "No se han encontrado ningun registro aun";
}
$registros=5;
$pagina=$_GET["num"];
$inicio=(($pagina-1)*$registros);
else
$inicio=0;
$rst_clientes=mysql_query("select * from cliente order by apepat LIMIT $inicio,$registros",$conexion);//ACA TAMBIEN DEBO DE PONER EL FILTRO QUE E PUESTO ARRIBA PERO NO SE COMO $paginas=ceil($num_registros/$registros);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>::Listar Clientes</title>
<?php
include('links.php');
?>
<link type="text/css" href="datepicker/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="datepicker/jquery-1.4.2.js"></script>
<script type="text/javascript" src="datepicker/jquery.ui.core.js"></script>
<script type="text/javascript" src="datepicker/jquery.ui.widget.js"></script>
<script type="text/javascript" src="datepicker/jquery.ui.datepicker.js"></script>
<link type="text/css" href="demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
$("#datepicker").datepicker();
$("#format").change(function(){ $('#datepicker').datepicker('option', {dateFormat: $(this).val()}); });
});
</script>
</head>
<body>
<table width="837" border="0" align="center" id="bgprincipal">
<tr valign="middle" align="center">
<td colspan="2"><img src="imagenes/banner.png" width="781" height="123" /></td>
</tr>
<tr>
<?php
echo "<td colspan=2 align=\"right\" valign=\"middle\">Bienvenido ";
echo $usuario." | <a href=\"cerrarsesion.php\">Cerrar Sesión</a></td>";
?>
</tr>
<tr>
<td width="139" height="24"><a href="clientes.php">REGISTRAR</a>-LISTAR</td>
<td width="688"> </td>
</tr>
<tr valign="top">
<td height="150" align="center">
<?php
include('menu.php');
?>
</td>
<td align="left" valign="top">
<table width="650" height="10" align="center">
<tr>
<td><div align="right"><a href="clientenuevo.php"><input type="image" src="imagenes/icontexto-user-web20-netvibes.png" title="agregar cliente"/></a></div></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="get" action="listarclientes.php">
Buscar
<input name="busqueda" type="text" id="busqueda" value="<?php echo $_GET["busqueda"];?>" />
<input type="image" src="imagenes/magnifier.png"name="btnBuscar" id="btnBuscar" value="Buscar" />
<?php
echo $mensaje;
?>
</form>
</td>
</tr>
</table>
<table width="650" height="52" border="1" align="center">
<tr>
<td width="128" bgcolor="#0066FF"><div align="center">Cliente</div></td>
<td width="58" bgcolor="#0066FF"><div align="center">Fecha</div></td>
<td width="54" bgcolor="#0066FF"><div align="center">DNI</div></td>
<td width="83" bgcolor="#0066FF"><div align="center">Direccion</div></td>
<td width="81" bgcolor="#0066FF"><div align="center">Telefono</div></td>
<td width="62" bgcolor="#0066FF"><div align="center">Email</div></td>
<td width="67" bgcolor="#0066FF"><div align="center">Modificar</div></td>
<td width="58" bgcolor="#0066FF"><div align="center">Eliminar</div></td>
</tr>
<?php
{
?>
<tr>
<td><?php echo $fila["apepat"]." ".$fila["apemat"]." ".$fila["nombre"] ;?></td>
<td><?php echo $fila["fecha"] ;?></td>
<td><?php echo $fila["dni"] ;?></td>
<td><?php echo $fila["direccion"] ;?></td>
<td><?php echo $fila["telefono"] ;?></td>
<td><?php echo $fila["email"] ;?></td>
<td align="center"><a href="modificarclientes.php?cod=<?php echo $fila["id"] ;?>"><input type="image" src="imagenes/page_white_edit.png"></a>
<td align="center"><a href="confirmarEliminacion.php?cod=<?php echo $fila["id"] ;?>">
<input type="image" src="imagenes/cancel.png"></a></tr>
<?php
}
?>
</table>
<p align="center">
<?php
if($pagina>1)
echo "<a href='listarclientes.php?num=".($pagina-1) ."'>Anterior</a> ";
for($cont=1;$cont<=$paginas;$cont++)
{
if($cont==$pagina)
echo $cont ." ";
else
echo "<a href='listarclientes.php?num=". $cont ."'>$cont</a> ";
}
if($pagina<$paginas)
echo "<a href='listarclientes.php?num=".($pagina+1) ."'>Siguiente</a> ";
?>
</p>
</td>
</tr>
</table>
</body>
</html>