PHP :Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given : <p>i am trying to  fetch data as per following query </p>

<pre><code>$query= "SELECT * FROM residential "; 
            if($type!=""){
             $query.=" AND  type='$type'";
            }
            if($unit_type!=""){
             $query.=" AND  unit_type='$unit_type'";
            }
            if(($min_price!="") &amp;&amp; ($max_price!="")){
             $query.=" AND  price BETWEEN '$min_price' AND '$max_price' ";
            }
            if(($min_bedrooms!="") &amp;&amp; ($max_bedrooms!="")){
             $query.=" AND bedrooms BETWEEN '$min_bedrooms' AND '$max_bedrooms'";
            }
            if($query==FALSE){
                echo mysqli_error($connect);
                die;
            }
            $result= mysqli_query($connect,$query);
</code></pre>

<p>this is how i use it </p>

<pre><code>&lt;div class="row"&gt;
    &lt;?php if(mysqli_num_rows($query)&gt;0):?&gt;
    &lt;?php while($row=  mysqli_fetch_assoc($query)):
        print_r($row);
        die;
    ?&gt;

    &lt;div class="col-md-4 col-sm-4 col-xs-12"&gt;
        &lt;div class="row property-listing"&gt;
            &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
               &lt;img src="images/1.png" class="img-responsive full-width"&gt; 
            &lt;/div&gt;
            &lt;div class="col-md-6 col-sm-6 col-xs-12 property-desc"&gt;
                &lt;h3&gt;AED&lt;br/&gt;  &lt;?php echo $row['price'];?&gt;&lt;/h3&gt;
                &lt;h5&gt;Unit Type: &lt;?php echo $row['unit_type'];?&gt;&lt;/h5&gt;
                &lt;h5&gt;Available for :&lt;?php echo $row['type'];?&gt;&lt;/h5&gt;
                &lt;h5&gt;Location :&lt;?php echo $row['area'];?&gt;&lt;/h5&gt;
                &lt;h5&gt;Bedrooms :&lt;?php echo $row['bedrooms'];?&gt;&lt;/h5&gt;
            &lt;/div&gt;
        &lt;/div&gt;


    &lt;/div&gt;

    &lt;?php endwhile;?&gt;
    &lt;?php else:
        echo 'We found no record for your search criteria ';
        echo '&lt;a href="index.html"&gt;Refine Search&lt;/a&gt;'
        ?&gt;

    &lt;?php endif;?&gt;

&lt;/div&gt;
</code></pre>

<p>This is what i get as error </p>

<blockquote>
  <p>( ! ) Warning: mysqli_num_rows() expects parameter 1 to be
  mysqli_result, string given</p>
</blockquote>

<p>values being posted and fetched are correct but something is wrong with query , Please help me sort it out </p>

<p>Thanks </p>
