<?php
for($i=1;$i<=10;$i++)
{
$sql = mysql_query("SELECT * FROM users WHERE id = '$i' order by id asc");
$datas=mysql_fetch_array($sql );
$username = stripslashes(str_replace('\r\n', '<br>',($datas['username'])));
echo $name.$i = $username."<br>";
}
?>
หรืออีกวิธี
Code (PHP)
$sql = mysql_query("SELECT * FROM users WHERE id = '$i' order by id asc");
while($datas=mysql_fetch_array($sql ){
$k++;
echo $result_username.$k=$datas['username']."<br>";
}