title: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL Result in line 40
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select">mysql_fetch_array() expects parameter 1 to be resource, boolean given in select</a>  </p>
  </blockquote>
  
  
  
  <p>i keep getting the error 
   Warning: mysql_fetch_array(): supplied argument is not a valid MySQL Result in line 40
  on my webpage i dont know why.. please help me .
  Background: this script is to pull my database tables up named yname,username,password,date,comments,works,dworks
   the works and dworks are for people who tryed what came up and then they can judge if it 
  works - yes it works
  dworks - no it dosent work 
  its supposed to be voting sortof well forget about that my problem is on like 40 of this script please help me</p>
  
  <pre><code>&lt;php require "br.htm" ?&gt;
  &lt;style&gt;
  &lt;?php require "styles.css" ?&gt;
  &lt;/style&gt;
  &lt;?php
  
  $host="host"; // Host name 
  $username="name"; // Mysql username 
  $password="pass"; // Mysql password 
  $db_name="dbname"; // Database name 
  $tbl_name="passes"; // Table name 
  
  // Connect to server and select database.
  mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
  mysql_select_db("$db_name")or die("cannot select DB");
  
  // select record from mysql 
  $sql="SELECT * FROM $tbl_name order by id desc";
  $result=mysql_query($sql);
  ?&gt;
  &lt;table background='https://lh6.ggpht.com/DFABQFuYSXLBiB6qlvDPfOONOUxCiwM6_S-dHnjW82iognQToTkORsy7RVXsAz0Y23w=w705' width='50%'&gt;
  &lt;tr&gt;
  &lt;th align='center'&gt;Submition By&lt;/th&gt;&lt;th align='center'&gt;ScreenName&lt;/th&gt;&lt;th align='center'&gt;Password&lt;/th&gt;&lt;th align='center'&gt;Does This Work?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;th align='center'&gt;
  &lt;hr color='lime' width='100%'/&gt;
  &lt;/th&gt;
  &lt;th align='center'&gt;
  &lt;hr color='lime' width='100%'/&gt;
  &lt;/th&gt;
  &lt;th align='center'&gt;
  &lt;hr color='lime' width='100%'/&gt;
  &lt;/th&gt;
  &lt;th align='center'&gt;
  &lt;hr color='gold' width='100%'/&gt;
  &lt;/th&gt;
  &lt;/tr&gt;
  &lt;?php
  while($rows=mysql_fetch_array($result)){
  ?&gt;
  
  &lt;tr&gt;
  &lt;td background='transparent' align='left'&gt;&lt;i&gt;&lt;b&gt;&lt;? echo $rows['yname']; ?&gt; &lt;/b&gt;&lt;/i&gt;&lt;/td&gt;
  &lt;td background='transparent' align='center'&gt;&lt;i&gt;&lt;b&gt;&lt;? echo $rows['username']; ?&gt;&lt;/b&gt;&lt;/i&gt;&lt;/td&gt;
  &lt;td background='transparent' align='right'&gt;&lt;i&gt;&lt;b&gt;&lt;? echo $rows['password']; ?&gt;&lt;/b&gt;&lt;/i&gt;&lt;/td&gt;
  &lt;td background='transparent' align='right'&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Yes&lt;? echo $rows['works']; ?&gt;&lt;/b&gt;&lt;/i&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php
  // close while loop 
  }
  ?&gt;
  
  &lt;/table&gt;
  
  &lt;?php
  // close connection; 
  mysql_close();
  ?&gt;
  &lt;center&gt; 
  </code></pre>
  
  <p>i dont want to re-style the page but if i have to i will.. if you see what is wrong please make a post below and tell me what line its on and how to correct it please then ill come back and let u know if it works :) thank you </p>