The following code does not work because time_to_sec() works on the 24 hour clock and cannot work between 2 days. For example a session started at 11:59 PM will not carry forward until 12:01 AM based on this logic.
Does anyone have a better solution for me? David McInnis $sql = "select *, (time_to_sec(now()) - time_to_sec(dt_expire)) as elapsed from sessions_client where sessionid = '$cp_sessionid'"; $result = @mysql_query($sql, $connection) or die ('Database Error - Could not query sessions_client.'); $numrows = mysql_num_rows($result); if ($numrows == 1) { $data = mysql_fetch_array($result); $clientid = $data["clientid"]; $dt_lastaccess = $data["dt_lastaccess"]; $elapsed = $data["elapsed"]; if ($elapsed < 0) { // validate session // this is where the logic fails around midnight } } else { // expired session } SQL and Query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php