Allora ti converrebbe mettere tutto in un array, quindi:
Codice PHP:
$array = array ();
while ( 
$row mysql_fetch_array($result) ) {
    
$array [$row ['uid']] ['username'] = $row ['username'];
    
$array [$row ['uid']] ['value'] [] = $row ['value'];

poi stampi il codice html

Codice PHP:
foreach ( $array as $uid => $valori ) {
    echo 
"<tr><td> $valori[username]</td><td> $uid</td><td>";
    foreach ( 
$valori as $value ) {
        echo 
"<tr><td> $value </td>";
    }
    echo 
"</tr>";

N.B. lo devi provare, potrei aver commesso qualche errore, non avendo la tabella del db.