while($row = mysql_fetch_array($sql)){ // Build your formatted results here. echo $row['Surname'] . " ID: " . $row['ID'] . "<br />"; }