2 Replies - 1878 Views - Last Post: 26 July 2011 - 01:22 AM Rate Topic: -----

#1 msalehi1991  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-July 11

Mysql_fetch_array() expects parameter 1 to be resource!

Posted 25 July 2011 - 11:46 PM

Hi every body
i'm new in php-forum. i have a problem with my code.please help me if you can.
when i run this code i get this error:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\MspOnline\html\Main.php on line 16

this is my code in main.php page:

      <?php
       $result=mysql_query("SELECT * FROM `main` ORDER BY id");
       while($row=mysql_fetch_array($result)){
       $text=$row['body'];
       echo nl2br('$text');
       }
       ?>



Any help would be great! Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Mysql_fetch_array() expects parameter 1 to be resource!

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Mysql_fetch_array() expects parameter 1 to be resource!

Posted 26 July 2011 - 12:51 AM

your query failed. see here for a more detailed explanation of this problem.
Was This Post Helpful? 0
  • +
  • -

#3 msalehi1991  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-July 11

Re: Mysql_fetch_array() expects parameter 1 to be resource!

Posted 26 July 2011 - 01:22 AM

than you very much
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1