Error fetching list in MYSQL

0

I have a problem in my system to send newsletter emails, when loading the index, where the list of registered emails are 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

At line 284 it looks 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 it?

Thank you all for trying to help.

    
asked by anonymous 16.03.2016 / 15:23

1 answer

1

I think you might be using the $ result within that while doing something to make it false

         <?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"];
      }
    
16.03.2016 / 15:31