I have a radius server that the user will signup and create a user name
once they have done this they will proceed to a user login form.
When they login i need the popup which enable them to logoff (already working) to show their total usage. This popup will update to give them a usuage figure every 5 minutes.
My Problem
Their username will always be in the last row of data entered, the id auto increments so in the popup i need some code that will find their username that was created in the last row and pass the answer over eg username = johndoe and then the second mysql query would have a definite name
$dbResult = mysql_query ( "SELECT CAST(SUM(`AcctInputOctets`) +

SUM(`AcctOutputOctets`) AS CHAR)" . "FROM radacct WHERE UserName = "johndoe" );
my initial thought was something like this
$query = "SELECT RadAcctid FROM radacct ORDER BY RadAcctid DESC LIMIT 1";
$result = mysql_query($query) or die(mysql_error());
$grab = mysql_fetch_assoc($result);
$max = $grab['RadAcctid'];
but its not quite working
any help would be appreciated