ahi esta el codigo!!
buscar.php
Código PHP:
<form action="busqueda.php" id="formulario" method="post" name="formulario" onsubmit="onEnviar()">
<div style="height:26px;"><select name="select" id="ejemplar"><option value="er.NombreEjemplar">Ejemplar</option><option value="er.NombreJinete">Jinete</option><option value="er.NombrePreparador">Preparador</option><option value="NombreStud">Stud</option><!--option value="er.NombrePropietario">Propietario</option--><option value="NombreCriador">Criador</option>
</select></div>
<?php
require_once("admin/config.php");
mysql_connect(HOST,USER,PASS);
mysql_select_db(BBDD);
$sqleco ='SELECT DATE_FORMAT(FechaReunion, "%d-%c-%Y") as fecha, DATE_FORMAT(FechaReunion, "%Y-%c-%d") as fecha2 from CARRERAS group by FechaReunion ORDER BY `FechaReunion` DESC';
$rest = mysql_query($sqleco);
?>
<div style="height:25px;">
<select id="fecha">
<option value="">-Fecha-</option>
<?php while ($apr = mysql_fetch_assoc($rest)):?>
<option value="<?php echo $apr['fecha2']?>"><?php echo actual_date($apr['fecha'])?></option>
<?php endwhile; ?>
</select></div>
<div style="height:30px;"><input type="text" name="texto" id="texto" />
<button type="submit" value="Buscar" style="background:#2d3f63; color:#FFFFFF; font-family:century gothic; "/> buscar</button></div>
</form>
<script type="text/javascript">
function onEnviar(){
var ejemplar = document.formulario.ejemplar.value;
var fecha = document.formulario.fecha.value;
var texto = document.formulario.texto.value;
//document.Buscar.submit();
window.open("busqueda.php", '', 'location=no,scrollbars=no,resizable=no');
}
</script>
busqueda.php
Código PHP:
<!-- los resultados -->
<style type="text/css">
.divcuerpo {
height: 0px;
width: 470px;
overflow-y:auto;
overflow-x: hidden;
}
table.estile td {
background:#2d3f63;
color:#FFFFFF;
-moz-border-radius:25px 25px 0px 0px;
}
table.estile th {
border: 1px solid #000;
background-color: #eee;
text-align: center;
}
table.estail td {
text-align: center;
border: 1px solid #aaaaee;
font-size:10px;
line-height:100%;
text-transform:capitalize;
width:80px;
max-width:78px;min-width:78px;
overflow: hidden;
padding:1px;
border-collapse:separate;
border-spacing:1px;
-moz-border-radius: 5px 5px 0px 0px;
}
.cortar {
overflow: hidden;
width: 78px;
}
</style>
<table class="estile">
<tr><td colspan="6" align="center"><strong>RESULTADO DE BUSQUEDA</strong></td></tr>
<tr>
<th align="center" width="26px">#</th>
<th align="center" width="80px">Ejemplar</th>
<!-- <th align="center" width="80px">Prop.</th> -->
<th align="center" width="80px">Prep.</th>
<th align="center" width="80px">Jinete</th>
<th align="center" width="80px" >Stud</th>
</tr></table>
<div id="bodirs" class="divcuerpo">
<table class="estail">
<?php
require_once("admin/config.php");
mysql_connect(HOST,USER,PASS);
mysql_select_db(BBDD);
mysql_query("SET NAMES 'utf8'");
$query='SELECT e.NombreEjemplar, NombreJinete, NombrePreparador, er.NumeroCarrera,c.NumeroCarreraInterno, NombreStud, NombrePropietario, NumeroMandil, NombreCriador, DATE_FORMAT( er.FechaReunion, "%d-%c-%Y" ) AS fecha
FROM EJEMPLARES_REUNION er
INNER JOIN EJEMPLARES e ON er.NombreEjemplar=e.NombreEjemplar
INNER JOIN STUD ON STUD.Propietario=er.NombrePropietario
INNER JOIN CARRERAS c ON c.FechaReunion=er.FechaReunion and c.NumeroCarrera=er.NumeroCarrera';
$query.=" WHERE ".mysql_real_escape_string(@$_REQUEST["ejemplar"])." like '%".mysql_real_escape_string(@$_REQUEST["texto"])."%'";
$query.=($_REQUEST["fecha"])? " AND er.FechaReunion = '".mysql_real_escape_string(@$_REQUEST["fecha"])."'":"";
$query.=" GROUP BY NombreEjemplar ORDER BY er.FechaReunion DESC";
//echo $query;
$resp = mysql_query($query);
$sql2 = "select * from EJEMPLARES_REUNION left join CARRERAS on (CARRERAS.NumeroCarrera = EJEMPLARES_REUNION.NumeroCarrera ) where EJEMPLARES_REUNION.FechaReunion = '".$row[FechaReunion]."' group by NumeroMandil";
//echo $sql2;
$rezul = mysql_query($sql2);
while($jin = mysql_fetch_array($rezul)){
//print_r($jin);
echo "<a href='../detalle-programa-carreras.php?nc=".$row['NumeroCarrera']."'>".floatval($jin['NumeroCarreraInterno'])."ª</a>/".floatval($jin[NumeroMandil])." ";
}
while ($row= mysql_fetch_array($resp)) {
echo "<tr>
<td width=\"24px\" style=\"max-width:24px;min-width:24px;\"><a href='../detalle-programa-carreras.php?nc=".$row['NumeroCarrera']."&fecha=".$_REQUEST["fecha"]."'>".floatval($row['NumeroCarreraInterno'])."ª</a></td>
<td width=\"19px\" style=\"text-align: left;font-weight:bold;\"><div class=\"cortar\">".strtolower($row['NombreEjemplar']). "</div></td>
<!-- <td width=\"80px\"><div class=\"cortar\">".$row['NombrePropietario']. "</div></td> -->
<td width=\"80px\"><div class=\"cortar\">".$row['NombrePreparador']. "</div></td>
<td width=\"80px\"><div class=\"cortar\">". $row['NombreJinete']. "</div></td>
<td ><div class=\"cortar\">". $row['NombreStud']. "</div></td><tr>";
}
while($jin = mysql_fetch_array($rezul)){
//print_r($jin);
echo "<a href='../detalle-programa-carreras.php?nc=".$jin[1]."'>".floatval($jin['NumeroCarreraInterno'])."ª</a>/".floatval($jin[NumeroMandil])." ";
}
?>
</table></div>