title: how can I get row number via php/mysqli
body: <pre><code>id  state
  1     1
  2     0
  5     1
  4     0
  7     1
  </code></pre>
  
  <p>I want first remove all <code>state=0</code> form my result. and then return row number of target record.</p>
  
  <p>for example for <code>id='7'</code> it must return me <code>3</code></p>
  
  <p>how can I do it with mysqli/php?</p>
  
  <p>this is false but something like this: </p>
  
  <pre><code>  function getLogs($itime = 0,$count = null)
      {
          $conn = $this-&gt;connectDB();
          $sql = "SELECT num_rows() FROM Content Where id='22' and  $state=0 ORDER BY id ASC";
          $rows = mysqli_fetch_all($conn-&gt;query($sql), MYSQLI_ASSOC);
          $this-&gt;disconnectDB($conn);
          return num_rows();
      }
  </code></pre>