Ver Mensaje Individual
  #7 (permalink)  
Antiguo 06/10/2011, 13:28
rana_bar_1
 
Fecha de Ingreso: octubre-2011
Mensajes: 5
Antigüedad: 12 años, 7 meses
Puntos: 0
Respuesta: Podrian ayudarme a resaltar de color los datos de busqueda

Cita:
Iniciado por andresdzphp Ver Mensaje
A ver si así te ayudan

Código PHP:
Ver original
  1. <?php
  2. include ("conec.php");
  3. error_reporting(E_PARSE);
  4.  
  5. $busqueda = $_POST["Busqueda"];
  6.  
  7. if ($busqueda != "") {
  8.     $lsQryB = "select idEmpresa from (Select idEmpresa,NomEmpresa,NomContacto,ApellidosContacto ,PuestoContacto from visionaria.OracleCuliacan where NomContacto<>'' Limit 10) as Tabla where idEmpresa like '%$busqueda%' or NomContacto like '%$busqueda%'";
  9.     $resultado2 = mysql_query($lsQryB) or die(mysql_error());
  10.     $conteo = mysql_num_rows($resultado2);
  11. }
  12.  
  13. $lsQry = "Select idEmpresa,NomEmpresa,NomContacto,ApellidosContacto ,PuestoContacto from visionaria.OracleCuliacan where NomContacto<>'' Limit 10";
  14. $resultado = mysql_query($lsQry) or die(mysql_error());
  15.  
  16. ?>
  17. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  18. <html xmlns="http://www.w3.org/1999/xhtml">
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <title>Untitled Document</title>
  22. <style type="text/css">
  23. div.centrado {
  24.     text-align: center;
  25. }
  26.  
  27. div.centrado table {
  28.     margin: 0 auto;
  29.     text-align: left;
  30. }
  31. </style>
  32. <script language="javascript">
  33.  
  34. function Busca()
  35. {
  36. document.form1.action="in.php";
  37. document.form1.submit();
  38. }
  39.  
  40. </script>
  41. </head>
  42. <body>
  43. <div class="centrado">
  44. <table width="732" height="149" border="0">
  45.     <tr>
  46.         <td width="55">&nbsp;</td>
  47.         <td width="592" style="text-align: center">
  48.         <form id="form1" name="form1" method="post" action="#">Busqueda <input
  49.             type="text" name="Busqueda" id="Busqueda" /> <input type="button"
  50.             name="Enviar" id="Enviar" value="Buscar" onclick="Busca()" /></form>
  51.         </td>
  52.         <td width="63">&nbsp;</td>
  53.     </tr>
  54.     <tr>
  55.         <td>&nbsp;</td>
  56.         <td style="text-align: center">
  57. <?php
  58.  
  59. $i = 0;
  60.  
  61. if ($conteo != 0) {
  62.     while ($arrBusqueda = mysql_fetch_array($resultado2)) {
  63.         $arrValores[$i] = $arrBusqueda["idEmpresa"];
  64.         $i++;
  65.     }
  66. } else
  67.     echo "No existen Empresas";
  68.  
  69. echo "<table border=\"1\">";
  70. echo "<tr>";
  71. echo "<td>Id Cliente</td>";
  72. echo "<td>Empresa</td>";
  73. echo "<td>Nombre</td>";
  74. echo "<td>Apellidos</td>";
  75. echo "<td>Puesto</td>";
  76. echo "</tr>";
  77.  
  78. while ($arrRegistros = mysql_fetch_array($resultado)) {
  79.    
  80.     for ($j = 0; $j <= $i; $j++) {
  81.         if ($arrRegistros["idEmpresa"] == $arrValores[$j]) {
  82.             echo "<tr style=\"background-color:#653\">";
  83.             $m = 1;
  84.         } else
  85.             $m = 0;
  86.     }
  87.    
  88.     if ($m = 0)
  89.         echo "<tr>";
  90.     echo "<td>" . $arrRegistros["idEmpresa"] . "</td>";
  91.     echo "<td>" . $arrRegistros["NomEmpresa"] . "</td>";
  92.     echo "<td>" . $arrRegistros["NomContacto"] . "</td>";
  93.     echo "<td>" . $arrRegistros["ApellidosContacto"] . "</td>";
  94.     echo "<td>" . $arrRegistros["PuestoContacto"] . "</td>";
  95.     echo "</tr>";
  96.  
  97. }
  98. echo "</table>";
  99. ?>
  100. </td>
  101.         <td>&nbsp;</td>
  102.     </tr>
  103.     <tr>
  104.         <td>&nbsp;</td>
  105.         <td>&nbsp;</td>
  106.         <td>&nbsp;</td>
  107.     </tr>
  108. </table>
  109. </div>
  110. </body>
  111. </html>
jejejej muchas gracias!!