Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 14700

barra de procurar

$
0
0
bom dia, eu estou tendo umas dificuldades em fazer o procurar

tenho este código:

Código :
<?php
include("config/config.php")
$search=$_POST['search'];
$sql = "SELECT * FROM ficherio WHERE nome_ficheiro like '%$search%' OR numero like '%$search%' OR dataa like '%$search%' OR descricao like '%$search%' order by dataa";
$result = mysql_query($sql) or die(mysql_error());
$number=mysql_num_rows($result);
echo"
<h2>$number resultados da pesquisa:</h2>
";
echo"<table>";
echo"
<tr class='info'>
   <td align='center'>Nome do Ficheiro</td>
   <td align='center'>Número</td>
   <td align='center'>Ficheiro</td>
   <td align='center'>Data</td>
   <td align='center'>Descrição</td>
   <td align='center'>Documentos relacionados</td>
   <td align='center'>Em Vigor</td>
   <td align='center'>Observações</td>
   <td align='center'>Editar</td>
   <td align='center'>Eliminar</td>
  </tr> ";

while ($row=mysql_fetch_array($result)){
$nficheiro = $row["nome_ficheiro"];
$numero = $row["numero"];
$data = $row["dataa"];
$descricao = $row["descricao"];
$filename = "img/$Ficheiro";


while($row = mysql_fetch_object($new)) {
   if ($row->is_active == 0) {
         echo "<tr class='danger'>";
    } else
         if ($row->is_active == 1) {
          echo "<tr class='success'>";
         }
    echo "
         <td maxlength='20'>". $row->nome_ficheiro ."</td>
         <td align='right'>". $row->numero."</td>
         <td><a href='index.php?mod=download&id=$row->id_ficheiro'><button class='btn btn-success'> Download </button></a></td>
         <td align='center'>". $row->dataa ."</td>
         <td>". $row->descricao."</td>
         <td>". $row->documentos_relacionados."</td>";
    ?>
         <?php
         if ($row->is_active == 0) {
          echo "<td align='center'><a href='index.php?s=1&id=$row->id_ficheiro&ativo=$row->is_active'><img width='20' height='20' src='http://www.clipartbest.com/cliparts/ecM/jkp/ecMjkp7cn.png'></img></td></td>";
         } else
          if ($row->is_active == 1) {
           echo "<td  align='center'><a href='index.php?s=1&id=$row->id_ficheiro&ativo=$row->is_active'><img width='20' height='20' src='https://cdn3.iconfinder.com/data/icons/simple-web-navigation/165/cross-512.png'></img></a></td>";
          }
         ?>  
    <?php
    echo" <td>". $row->observacao ."</td>
         <td align='center'><a href='index.php?mod=editar_ficheiro&id=$row->id_ficheiro'><img width='20' height='20' src='https://cdn0.iconfinder.com/data/icons/back-to-school/90/circle-school-learn-study-subject-math-pencil-edit-512.png'></img></a></td>
         ";
    ?>
    <td>
         <?php echo "<a href='index.php?mod=delete&id=$row->id_ficheiro'><button type='button' class='btn btn-danger' onclick='myFunction()'> Eliminar</button></a>
    </td>
   </tr>
"; ?>
<?php
if(!file_exists($filename)){
  $filename ="error";
}
}

echo"</table>";
?>

o problema aqui é que não faz a procura, se alguem me podesse ajudar ficaria muito agradecido!

e no index.php tenho:

Código :
echo"
  <form method='post' action='index.php?mod=search'  id='searchform'>
           <input type='text' name='search' placeholder='Procurar'>
           <input class='btn btn-primary' type='submit' name='submit' value='Search'>
   </form>

";

Viewing all articles
Browse latest Browse all 14700