Error while searching list in MYSQL

Asked

Viewed 29 times

0

I have a problem in my system of sending emails newsletter, when loading the index, where the list of registered emails is loaded, the following error appears:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean   given in /home/barie742/public_html/admin/admin/index.php on line 284

On line 284 it’s like this:

  <?php
  $sql = mysql_query("SELECT * FROM n_emails order by -id");
  while($lista2 = mysql_fetch_array($sql)){  /* line 284 */
  $email = $lista2["email"];
  $ativo = $lista2["ativo"];

What could be wrong ? And how can I fix ?

I thank all who try to help.

1 answer

1


I think you might be using $result inside that while to do something making it fake

         <?php
      $sql = mysql_query("SELECT * FROM n_emails order by -id");
      $resultado = mysql_query($sql) or die(mysql_error());
      while($lista2=mysql_fetch_array($resultado)) {
          $email = $lista2["email"];
          $ativo = $lista2["ativo"];
      }
  • You have deleted the error but now it is showing: Query was Empty

  • 2

    There, there’s your problem, query is not returning anything after $result is false (bool)

  • So my error is deeper? Have registered emails and does not appear, error in database connection?

  • It may be something in your query, you will have to see better what you are looking for and where you are looking for, if my answer solved the problem mark as answered :)

  • thanks to friend help, problem solved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.