Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6169146/php-warning-sort-expects-parameter-1-to-be-array-resource-given">PHP: Warning: sort() expects parameter 1 to be array, resource given </a>  </p>
</blockquote>



<p>I m beginner in php. When i'm running the code given below return a warning like,</p>

<p>Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C...
my code is:</p>

<pre><code>&lt;?php

$con = mysql_connect('localhost','root','password') or die("could not connect".mysql_error());

mysql_select_db('test',$con);

if(isset($_POST['subm']))
{
$val=$_POST['val1'];   // Takes value from textbox named val1.

$qry=mysql_query("select * form user where id='$val'");
    while ($row = mysql_fetch_array($qry)) 
    {
    echo $row['fname'];
    }
}
mysql_close($con);

?&gt;
</code></pre>
