title: Warning: mysql_query() expects parameter 1 to be string, resource given
body: <p>Warning: mysql_query() expects parameter 1 to be string, resource given in C:\wamp\www\life\homeSearch.php on line 20</p>
  
  <p>The code is working but displaying the above error. Here is the code:</p>
  
  <pre><code> &lt;?php 
        ob_start();
  require("config.php");
  ob_end_clean();
  
        $req=$_REQUEST['propertyType'];
  $req2=$_REQUEST['propertyStatus'];
  
  mysql_connect("localhost",$username,$password);
  mysql_select_db("$database") or die( "Unable to select database");
  
  if ($req!="all" &amp;&amp; $req2!="all") $query= "SELECT * FROM buildings WHERE propertyType='$req' AND propertyStatus='$req2'";
  else if($req=="all" &amp;&amp; $req2!="all" ) $query= "SELECT * FROM buildings WHERE propertyStatus='$req2'";
  else if($req!="all" &amp;&amp; $req2=="all" ) $query= "SELECT * FROM buildings WHERE propertyType='$req'";
  else if($req=="all" || $req2=="all" ) $query= "SELECT * FROM buildings";
  
  $result=mysql_query($query);
  $num=mysql_num_rows($result);
  
  mysql_query($result);
  
  
  mysql_close();
  
  $i=0;
  
  for ($i; $i &lt; $num; $i++){
      $f12=mysql_result($result,$i,"availability");
      $f13=mysql_result($result,$i,"propertyType");
      $f14=mysql_result($result,$i,"propertyStatus");
  
  echo $f12."  ".$f13." &lt;br /&gt;  ".$f14."&lt;br /&gt;";
  }
        ?&gt;
  </code></pre>