username
id name age
1 test 25
2 victor 22
3 test 24
<?php
include "conn.php";
$sql="SELECT DISTINCT name FROM `username` WHERE 1";
$exec=mysql_query($sql);
$i=0;
while($myrow=mysql_fetch_array($exec)){
//echo $myrow["name"]."<br/>";
$i=$i+1;
$a[$i]=$myrow["name"];
}
?>
<table width="200" border="1">
<?php
for($i=1;$i<=count($a);$i++){
?>
<tr>
<td><?=$a[$i];?></td>
<td>
<?php
$sql="select * from username where name='".$a[$i]."'";
$exec=mysql_query($sql);
while($myrow=mysql_fetch_array($exec)){
echo $myrow["age"]."<br/>";
}
?>
</td>
</tr>
<?php
}
?>
</table>