Jump to content
Fórum Script Brasil
  • 0

Consulta de usuário no banco de dados (Filtro).


mekker
 Share

Question

Estou tentando fazer uma consulta de usuário do banco de dados, porém ele não me trás o resultado alguém pode me ajudar?

 

 

 

<form name="enter" method="post" action="" enctype="multipart/form-data">
      Inserir código: <input type="text" name="pesquisa" />
<input type="submit" name="mandar" value="Buscar" />
     </form>

 


<?
if(isset($_POST['mandar'])){
         
         $pesquisa = $_POST['login'];

$sql = "SELECT * FROM usuario WHERE login LIKE'%pesquisa%'";


$limite = mysql_query("$sql");

while  ($sql = mysql_fetch_array ($limite) ) {

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Ele volta com o primeiro da tabela não com o que foi digitado no campo de pesquisa!!

 

<h20>Lista de Usu&aacute;rios do Sistema</h20>    
      <? require ("conn.php"); ?>
<form name="enter" method="post" action="" enctype="multipart/form-data">
      Inserir código: <input type="text" name="pesquisa" />
<input type="submit" name="mandar" value="Buscar" />
     </form>

 


<?
if(isset($_POST['mandar'])){

$login = $_POST['pesquisa'];

$sql = "SELECT * FROM usuario WHERE login LIKE'%".$pesquisa."%'";


$limite = mysql_query("$sql");

while  ($sql = mysql_fetch_array ($limite) ) {

$id = $sql['id'];
$nome = $sql['nome'];
$login = $sql['login'];
} ?>
    </p>
    <table width="700" border="0" cellspacing="0" cellpadding="0">
  <tbody>
  <tr>
          <td>Nome:<? echo $sql = "$nome";?></td>
</tr>
</tbody>
</table>
<? } ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...