Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. <div class="procurar">
  2. <input type="text" id="search" onkeypress="mandar()"><i class="fa fa-search" aria-hidden="true"></i>
  3. </div>
  4.  
  5. <div class="historico">
  6.  
  7. <table class="table" id="dados_entradas">
  8.  
  9. <?
  10. $historico = mysql_query("SELECT ut.nome, ut.contribuinte, en.id_ficha, DATE_FORMAT(en.data_entrada,'%d-%m-%Y') as data
  11. FROM entrada en,utilizador ut
  12. WHERE en.contribuinte = ut.contribuinte");
  13.  
  14. while($linhas = mysql_fetch_array($historico))
  15. {
  16. ?>
  17. <tr>
  18. <td style="width:25%;"><?echo $linhas['nome']; ?></td>
  19. <td style="width:25%;"><?echo $linhas['contribuinte']; ?> </td>
  20. <td style="width:25%;"><?echo $linhas['id_ficha']; ?> </td>
  21. <td style="width:25%;"><?echo $linhas['data']; ?></td>
  22. </tr>
  23.  
  24. <?
  25. }
  26. ?>
  27.  
  28. </table>
  29.  
  30. function mandar()
  31. {
  32. var search=$("#search").val();
  33.  
  34. $.post("dados-entradas.php",{search:search}, function(data){
  35. $("#dados_entradas").html(data);
  36.  
  37. });
  38. }
  39.  
  40. $search = $_POST['search'];
  41.  
  42. $historico = mysql_query("SELECT ut.nome, ut.contribuinte, en.id_ficha, DATE_FORMAT(en.data_entrada,'%d-%m-%Y') as data
  43. FROM entrada en,utilizador ut
  44. WHERE en.contribuinte = ut.contribuinte
  45. AND ut.nome = '$search'");
  46.  
  47. while($linhas = mysql_fetch_array($historico))
  48. {
  49.  
  50. echo"<table class='table' id='dados_entradas'>
  51. <tr>
  52. <td style='width:25%;'>".$linhas['nome']."</td>
  53. <td style='width:25%;'>".$linhas['contribuinte']."</td>
  54. <td style='width:25%;'>".$linhas['id_ficha']."</td>
  55. <td style='width:25%;'>".$linhas['data']."</td>
  56. </tr>
  57. </table>";
  58.  
  59.  
  60. }
  61.  
  62. <table class="table" id="dados_entradas">
  63.  
  64. ut.nome = '$search'
  65.  
  66. ut.nome LIKE '%" . $search . "%'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement