Log in

View Full Version : Second to First Row instead of first...



Rockonmetal
04-02-2008, 02:45 AM
I have logs of all the times users log in and out on my site for security reasons. It logs time, date, IPA, for that specific user. I want to display the second to first time *the time before the user logged in* So it would display:
You last logged in at 25:00 on the night of the 32nd :D lol...
I don't know how to do this using SQL from that specific page...
Thanks for the help

NXArmada
04-02-2008, 03:18 PM
What programming language are you using. PHP, ASP, etc.

Rockonmetal
04-02-2008, 06:35 PM
I am using php...

NXArmada
04-02-2008, 08:20 PM
Heres a sample of one way you can do it.



<?php
include 'include/config.php';
include 'include/opendb.php';

$sql = mysql_query("SELECT * FROM logs WHERE uid = CONVERT(_utf8 '$uid' USING latin1) COLLATE latin1_swedish_ci order by uid");

$q=mysql_fetch_array($sql);

$time=$q['time'];
$day=$q['day'];

echo "You last logged in at $time on the night of the $day";
?>