Jump to content

[SOLVED] ORDER BY


timmah1

Recommended Posts

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

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.