este es el codigo buscar:
Código PHP:
<?php
function cambiaf_a_mysql ($fecha){
if($fecha!='')
{
ereg( "([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})", $fecha, $mifecha);
$lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1];
return $lafecha;
}
else
{
return false;
}
}
$desde=$_POST['desde'];
$hasta=$_POST['hasta'];
$Numero=$_POST['Numero'];
$fechas="";
$IDGuiaPOST="";
if(cambiaf_a_mysql($desde)!=false && cambiaf_a_mysql($hasta)!=false)
{
$fechas="'".$desde."' <= p3.Fecha and p3.Fecha <= '".$hasta."' and ";
}
if($Numero!='')
{
$IDGuiaPOST="p3.id_op=".$Numero." and ";
}
echo "<script>alert(\"$Numero\")</script>";
//consultas sql
//consultas sql
$consulta ="select p1.id_Cliente, p2.Id_Empleado,p3.Fecha as Cliente,p4.Nombre as producto
from tblclientes as p1, tblempleados as p2, tbl_op as p3,tblproducto as p4,tblproducciones asp5
where ".$fechas." ".$IDGuiaPOST."
p3.id_Cliente=p1.id_Cliente
and p4.id_Producto=p5.id_Producto
and p3.id_op=p5.id_op order by p3.Fecha";
$_SESSION['consultEXCEL']=$consulta;
//$resCons=mysql_query($consulta);
echo"<h2>Informe Produccion :</h2>";
//$total=0;
while($row=mysql_fetch_array($resCons))
{
echo"<div class='datos'>
<b>Nombre Trabajador</b>: ".$row['Nombre']."<br>
</div><br>";
y este es donde armo el formulario de busqueda
Código PHP:
<form name="form1" method="post" action="busca_op.php">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0" class="oSuperior">
<!--DWLayoutTable-->
<tr>
<td width="144" height="86" valign="baseline"><p class="estilo1"> Trabajador<span class="txt">
<select name="Numero" id="Numero">
<?php
conectar();
$mydb=name;
$consulta="select Apellido, Id_Empleado from tblempleados where activo='1' order by Nombre";
$resultado=mysql_db_query($mydb,$consulta) or die("error al consultar nombres de equipos: ".mysql_error());
if (mysql_num_rows($resultado)!=0){
while ($campo = mysql_fetch_array($resultado)){
echo "<option value=\"".$campo['tblempleados']."\">".$campo['Apellido']."</option>";
}
}
?>
</select>
</span></p> </td>
<td width="4"> </td>
<td width="65" valign="baseline">Calendario
<input name="desde" type="text" id="desde" onclick="popUpCalendar(this, form1.desde, 'dd-mm-yyyy');" size="10" /></td>
<td width="4"> </td>
<td width="65" valign="baseline">Calendario
<input name="hasta" type="text" id="hasta" onclick="popUpCalendar(this, form1.hasta, 'dd-mm-yyyy');" size="10" /></td>
<td width="78" valign="baseline"><p>
</p> <p align="center">
<input name="Enviar" type="submit" class="optionitem" value="Ir" />
</p></td>
</tr>
</table>
</form>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\siap\Jose_Fechas\busca_op.php on line 111
si em pueden dar una mano pra solucionar el problema
saludos
pana tu que conoces mas el cod