Jump to content
Fórum Script Brasil
  • 0

O Que Ha Errado?


taudujas

Question

Aparece a seguinte mensagem:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/drogadal/public_html/dicas/pagina.php on line 8

O codigo é: busca.php

<html>

<head>

<title>Documento sem t&iacute;tulo</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>

<form name="form1" method="post" action="pagina.php">

  <table width="75%" border="0">

    <tr>

      <td width="39%"><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Busca:</font></strong></div></td>

      <td width="61%"><input name="busca" type="text" id="busca">

        <input type="submit" name="Submit" value="Enviar"></td>

    </tr>

  </table>

</form>

</body>

</html>

pagina.php

<?

include "config.php";

$busca = $_POST["busca"];//pega os dados digitados no formulario

// seleciona os dados do banco

$query = mysql_query("SELECT * FROM pna_artigos WHERE artigo like '%busca%'");

$contagem = mysql_num_rows($query);// verifica os numeros de linhas

if ($contagem == 0) //se for igual a zero

{

echo "<center><font color = \"#0000FF\">Não Achou Nenhum Registro</font></center>

<a href=\"javascript:history.go(-1)\"><center>Voltar</center></a>";

exit();

}

else{

//enquanto                    pega o array

while ($coluna = mysql_fetch_array($query)){

$artigo = $coluna["artigo"];

echo $artigo;

}

}

?>

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

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.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...