Jump to content

get last record by userID


dflow

Recommended Posts

im building a checkin checkout system

 

how would you approach this:

a user logs on his time and date are recorded and is logged out

 

then what i want is on the next login to update the last record

with time and date when logged out

 

how can i get the  last record entered by  userID?

Link to comment
https://forums.phpfreaks.com/topic/145233-get-last-record-by-userid/
Share on other sites

yes thanks

 

i have the query im trying to call but it isn't filtering the records table using the logged in username session variable:

 

$username_RsLastRecord = "-1";
if (isset($_SESSION['login_Username'])) {
  $user_RsLastRecord = $_SESSION['login_Username'];
}
mysql_select_db($database_shifts, $shifts);
$query_RsLastRecord = sprintf("SELECT * FROM records WHERE records.UserName=$username_RsLastRecord ORDER BY records.ShiftStartTimeStamp DESC", GetSQLValueString($username_RsLastRecord, "int"));
$RsLastRecord = mysql_query($query_RsLastRecord, $shifts) or die(mysql_error());
$row_RsLastRecord = mysql_fetch_assoc($RsLastRecord);
$totalRows_RsLastRecord = mysql_num_rows($RsLastRecord);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.