If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > code to retrieve username from last row entry

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-10, 04:23
tudorg tudorg is offline
Registered User
 
Join Date: Mar 2010
Posts: 1
code to retrieve username from last row entry

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
Tudor
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On