timmah1 Posted May 3, 2009 Share Posted May 3, 2009 If I have 20 entries in a database, and I want to show the first entry and the last entry, minus 1 entry, how would I do that? An example would be showing the current login time, and the last login time. I have a database that inputs the users info into a database upon login. I want to show them their current session, and the last time they logged in. So in essence, out of those 20 entries in the database, #20 would be the current session, and #19 would be the last, so how would I go about showing only #19 and #20? Does that make sense? Here is what I have at the moment, I'm just not sure how to get the last one. $sql1 = "SELECT * FROM quicklogin_myquicker_stats WHERE user = '$id' ORDER BY login DESC LIMIT 1"; Thanks in advance Link to comment https://forums.phpfreaks.com/topic/156617-solved-order-by/ Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 $sql1 = "SELECT * FROM quicklogin_myquicker_stats WHERE user = '$id' ORDER BY login DESC LIMIT 2"; Link to comment https://forums.phpfreaks.com/topic/156617-solved-order-by/#findComment-824681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.