The code below produces the result below
[b]code[/b]
$test=mysql_query("
select name
from myTable
limit 5
") ;
echo "[COLOR="Blue"]start[/COLOR]";
while( $row = mysql_fetch_array($test) )
{
echo $row['name']."<br>";
}
echo "[COLOR="blue"]end[/COLOR]";
[b]result[/b]
[COLOR="Blue"]start[/COLOR]
Tom
Jane
John
Kate
Tim
[COLOR="Blue"]end[/COLOR]
I like to make it to escape after 3 turns.
The would-be code below doesn’t work correctly, but I hope it shows what I want.
[b]would-be code[/b]
$test=mysql_query("
select name
from myTable
limit 5
") ;
$i=1;
echo "[COLOR="Blue"]start[/COLOR]";
while( $row = mysql_fetch_array($test) )
{
echo $row['name']."<br>";
if ($i==[COLOR="red"]3[/COLOR])
{ [COLOR="red"]escape()[/COLOR] }
$i=$i+1;
}
echo "[COLOR="blue"]end[/COLOR]";
[b]target result[/b]
[COLOR="blue"]start[/COLOR]
Tom
Jane
John
[COLOR="Blue"]end[/COLOR]