I see where you were going with max(). I'm trying something like this, but it will not give me the last value inserted into the database for each username.
$result = mysql_query("select username, paid, max(AM2_id) from AM2 group by username ") or die (mysql_error());
while ($row = mysql_fetch_array($result))