Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/06/2008, 15:04
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
Respuesta: Problema hacer con una busqueda

Muchas gracias, pero ya lo repare, les dejo el codigo para quien lo quiera usar.

Código PHP:
<form id="form1" name="form1" method="post" action="">
  <table width="800" border="0">
    <tr>
      <td><div align="center"><strong><a href="tabla.php">Home</a></strong></div></td>
      <td><div align="center"><strong>Ir a certifiaciones </strong></div></td>
      <td><div align="center"><strong>Buscar inspecci&oacute;n </strong></div></td>
      <td><div align="center"><a href="control_datos_filtro.php"><strong>Volver</strong></a></div></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <table width="800" border="0">
    <tr>
      <td>&nbsp;</td>
      <td><div align="center"><strong>AMECO CHILE S.A </strong></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><div align="center"><strong>Fecha:</strong> <? echo $fecha?></div></td>
      <td><div align="center"><strong>Informe estatus de inspecciones </strong></div></td>
      <td><div align="center"><strong>Hora:</strong> <? echo $hora?></div></td>
    </tr>
  </table>
  <p><strong>Proyecto</strong>:  <em><? echo $f_proyecto?></em> </p>
  <p>
  <?
  
echo "<select name=\"campo\">     <option value=\"ins_folio\">Folio</option>     <option value=\"ins_nomemp\">Empresa</option>           </select> <input type=\"text\" name=\"palabra\">   <input name=\"buscar\" type=\"submit\" value=\"Buscar\">"
  
  
?>
  
  &nbsp;</p>
  <table width="800" border="0">
    <tr>
      <td><div align="center"><strong>Folio</strong></div></td>
      <td><div align="center"><strong>Fecha ingreso </strong></div></td>
      <td><div align="center"><strong>Hora ingreso </strong></div></td>
      <td><div align="center"><strong>Empresa</strong></div></td>
      <td><div align="center"><strong>Nombre contacto </strong></div></td>
      <td><div align="center"><strong>E-mail</strong></div></td>
      <td><div align="center"><strong>Fono contacto </strong></div></td>
      <td><div align="center"><strong>Estado</strong></div></td>
    </tr>
        <?php 
 
if ( isset( $_POST'buscar' ] )  && isset( $_POST'campo' ] ) && isset( $_POST'palabra' ] )  )


$palabra $_POST['palabra']; 
$campo $_POST['campo']; 
echo 
$campo;
echo 
$palabra;

if ( 
$campo == 'ins_folio' )
$consulta "SELECT ins_folio,ins_fecing,ins_hora1,ins_nomemp,ins_nomcon,ins_mailcon,ins_fonocon,ins_estado FROM `am_inspeccion` where (ins_folio like '%".$palabra."%') and (ins_proyecto like '$f_proyecto')";


elseif ( 
$campo == 'ins_nomemp' )
$consulta "SELECT ins_folio,ins_fecing,ins_hora1,ins_nomemp,ins_nomcon,ins_mailcon,ins_fonocon,ins_estado FROM `am_inspeccion` where (ins_nomemp like '%".$palabra."%') and (ins_proyecto like '$f_proyecto')";

$query_Rs mysql_query($consulta) or die(mysql_error());

while ( 
$rowmysql_fetch_array$query_Rs ) )

{



$row[1]  = substr($row["1"],6,2)."/".substr($row["1"],4,2)."/".substr($row["1"],0,4); 



echo 
"    <tr>";
echo 
"      <td><div align=\"center\">$row[0]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[1]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[2]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[3]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[4]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[5]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[6]</a></div></td>";
echo 
"      <td><div align=\"center\">$row[7]</a></div></td>";
echo 
"    </tr>";

            }
}

          
    
?>
  </table>


</form>