php vs MySQLi, Which one is faster : <p>I want to execute a query to fetch data from 1000 rows in my database. I have found two methods to do that.</p>

<p>Method 1:</p>

<pre><code>SELECT * FROM user WHERE id=879
</code></pre>

<p>and second one which I used to protect myself from SQL Injection was:</p>

<p>Method 2:</p>

<pre><code>&lt;?php
$q="SELECT * FROM user";
$get_res=$dbconn-&gt;query($q);
while($set=$get_res-&gt;fetch_assoc()) {
 if($set['id']==879)
   {
      //Some task here
   }
}
</code></pre>

<p>So Which one is faster. I know about SQL prepared Statement.. But I just want to compare these two method..  And if there will be any security flaw in Method2 then Please explain that one also..</p>
