How to make loop
<p>This would helps me a lot to understand how does loop works</p>

<p>Let say i've database table <code>my_table (id,words)</code> and here is example of database</p>

<pre><code>INSERT INTO `my_table` VALUES (1,'hello manal');
INSERT INTO `my_table` VALUES (2,'nice manal');
INSERT INTO `my_table` VALUES (3,'pretty manal');
</code></pre>

<p>now imagine for 100,000 entries (huge) and i want to replce the word manal to jack and giving me results every line changed one by one </p>

<p>i'll use</p>

<pre><code>$conn = mysql_connect('localhost','USER','PASS') or die(mysql_error());
mysql_select_db('my_table',$conn);

$sql = "SELECT * from my_table";
$result = mysql_query($sql,$conn);

while ($row = mysql_fetch_array($result)){

$old = $row['words'];
$id = $row['id'];

$new="jack";
$new = str_replace("manal", "$new", $old);
echo $new;

}
</code></pre>

<p><strong>The loop</strong>
by that code it will works all at once which is impossible to my hosting server to apply all so i want to make it as loop ! i mean it will change the 1st database line then gives me the results <code>echo $new;</code> then change the 2nd database line then gives the results <code>echo $new;</code> and so on with no stop till last line.</p>

<p>so my important part is getting the results one by one ~thanks</p>
