Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="procurar">
- <input type="text" id="search" onkeypress="mandar()"><i class="fa fa-search" aria-hidden="true"></i>
- </div>
- <div class="historico">
- <table class="table" id="dados_entradas">
- <?
- $historico = mysql_query("SELECT ut.nome, ut.contribuinte, en.id_ficha, DATE_FORMAT(en.data_entrada,'%d-%m-%Y') as data
- FROM entrada en,utilizador ut
- WHERE en.contribuinte = ut.contribuinte");
- while($linhas = mysql_fetch_array($historico))
- {
- ?>
- <tr>
- <td style="width:25%;"><?echo $linhas['nome']; ?></td>
- <td style="width:25%;"><?echo $linhas['contribuinte']; ?> </td>
- <td style="width:25%;"><?echo $linhas['id_ficha']; ?> </td>
- <td style="width:25%;"><?echo $linhas['data']; ?></td>
- </tr>
- <?
- }
- ?>
- </table>
- function mandar()
- {
- var search=$("#search").val();
- $.post("dados-entradas.php",{search:search}, function(data){
- $("#dados_entradas").html(data);
- });
- }
- $search = $_POST['search'];
- $historico = mysql_query("SELECT ut.nome, ut.contribuinte, en.id_ficha, DATE_FORMAT(en.data_entrada,'%d-%m-%Y') as data
- FROM entrada en,utilizador ut
- WHERE en.contribuinte = ut.contribuinte
- AND ut.nome = '$search'");
- while($linhas = mysql_fetch_array($historico))
- {
- echo"<table class='table' id='dados_entradas'>
- <tr>
- <td style='width:25%;'>".$linhas['nome']."</td>
- <td style='width:25%;'>".$linhas['contribuinte']."</td>
- <td style='width:25%;'>".$linhas['id_ficha']."</td>
- <td style='width:25%;'>".$linhas['data']."</td>
- </tr>
- </table>";
- }
- <table class="table" id="dados_entradas">
- ut.nome = '$search'
- ut.nome LIKE '%" . $search . "%'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement