RE: [PHP] mysql query for current id-1
Awesome... Works perfectly!! Thanks for your help! __ Jason Dulberg Extreme MTB http://extreme.nas.net > -Original Message- > From: Maxim Maletsky (PHPBeginner.com) > [mailto:[EMAIL PROTECTED]] > Sent: October 2, 2001 1:03 AM > To: 'Jason Dulberg'; [EMAIL PROTECTED] > Subject: RE: [PHP] mysql query for current id-1 > > > > ... DESC LIMIT 1,1 > > As you wrote yourself. > > Sorry, haven't taken in consideration ;-) > > > Maxim Maletsky > www.PHPBeginner.com > > > > -Original Message- > From: Jason Dulberg [mailto:[EMAIL PROTECTED]] > Sent: martedì 2 ottobre 2001 6.59 > To: Maxim Maletsky (PHPBeginner.com); [EMAIL PROTECTED] > Subject: RE: [PHP] mysql query for current id-1 > > > Thank you for your lightning fast response!! > > I tried your query but it appears to be coming up with the current id > rather than the users last login. > > __ > Jason Dulberg > Extreme MTB > http://extreme.nas.net > > > > > -Original Message- > > From: Maxim Maletsky (PHPBeginner.com) > > [mailto:[EMAIL PROTECTED]] > > Sent: October 2, 2001 12:14 AM > > To: 'Jason Dulberg'; [EMAIL PROTECTED] > > Subject: RE: [PHP] mysql query for current id-1 > > > > > > > > > > What about this: > > > > $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') > > AS unixdate from logged_in WHERE userid='$current_user' ORDER BY id > > DESC LIMIT 1"; > > > > > > I think this should work for your case. > > > > Maxim Maletsky > > www.PHPBeginner.com > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mysql query for current id-1
... DESC LIMIT 1,1 As you wrote yourself. Sorry, haven't taken in consideration ;-) Maxim Maletsky www.PHPBeginner.com -Original Message- From: Jason Dulberg [mailto:[EMAIL PROTECTED]] Sent: martedì 2 ottobre 2001 6.59 To: Maxim Maletsky (PHPBeginner.com); [EMAIL PROTECTED] Subject: RE: [PHP] mysql query for current id-1 Thank you for your lightning fast response!! I tried your query but it appears to be coming up with the current id rather than the users last login. __ Jason Dulberg Extreme MTB http://extreme.nas.net > -Original Message- > From: Maxim Maletsky (PHPBeginner.com) > [mailto:[EMAIL PROTECTED]] > Sent: October 2, 2001 12:14 AM > To: 'Jason Dulberg'; [EMAIL PROTECTED] > Subject: RE: [PHP] mysql query for current id-1 > > > > > What about this: > > $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') > AS unixdate from logged_in WHERE userid='$current_user' ORDER BY id > DESC LIMIT 1"; > > > I think this should work for your case. > > Maxim Maletsky > www.PHPBeginner.com > > > > -Original Message- > From: Jason Dulberg [mailto:[EMAIL PROTECTED]] > Sent: martedì 2 ottobre 2001 6.04 > To: [EMAIL PROTECTED] > Subject: [PHP] mysql query for current id-1 > > > This is kindof a weird question so bear with me as I try to explain. > > I have a session table that gets updated when a user logs in/out. If > they don't logout, some info is left unchanged. I have a cron script > that takes care of the stray sessions so that's all good. In the > sessions table, there's a field "self_logout" which is Y when they > logout properly and N if the cron script removes their session. > > What I'd like to do is when the user logs in next time, a search will > be made to look at that users last login session info. If they didn't > log out properly, a notice will appear. > > So theoretically, I need to search for something like: > > "users current id -1" or their last time of visit. > > Here is the sql query that I have so far. But I think that I need to > remove the "self_logout='N'" because that doesn't show the actual last > result; rather it shows the last result where they didn't properly > logout. > > $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') > AS unixdate from logged_in WHERE (self_logout='N') AND > (userid='$current_user') ORDER BY id DESC LIMIT 1,1"; > > Here is my trimmed down table structure: > > CREATE TABLE logged_in ( > id tinyint(4) DEFAULT '0' NOT NULL auto_increment, > session varchar(100) DEFAULT '0' NOT NULL, > time_in timestamp(14), > time_out varchar(50) DEFAULT '-' NOT NULL, > self_logout char(1) DEFAULT 'N' NOT NULL, > KEY id (id) > ); > > Did that make any sense? To sum it all up, I just want to remind > people to click "logout" if they forgot the last time. > > Thanks for any suggestions!! > > __ > Jason Dulberg > Extreme MTB > http://extreme.nas.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] To > contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mysql query for current id-1
Thank you for your lightning fast response!! I tried your query but it appears to be coming up with the current id rather than the users last login. __ Jason Dulberg Extreme MTB http://extreme.nas.net > -Original Message- > From: Maxim Maletsky (PHPBeginner.com) > [mailto:[EMAIL PROTECTED]] > Sent: October 2, 2001 12:14 AM > To: 'Jason Dulberg'; [EMAIL PROTECTED] > Subject: RE: [PHP] mysql query for current id-1 > > > > > What about this: > > $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS > unixdate from logged_in WHERE userid='$current_user' ORDER BY id DESC > LIMIT 1"; > > > I think this should work for your case. > > Maxim Maletsky > www.PHPBeginner.com > > > > -Original Message- > From: Jason Dulberg [mailto:[EMAIL PROTECTED]] > Sent: martedì 2 ottobre 2001 6.04 > To: [EMAIL PROTECTED] > Subject: [PHP] mysql query for current id-1 > > > This is kindof a weird question so bear with me as I try to explain. > > I have a session table that gets updated when a user logs in/out. If > they don't logout, some info is left unchanged. I have a cron script > that takes care of the stray sessions so that's all good. In the > sessions table, there's a field "self_logout" which is Y when they > logout properly and N if the cron script removes their session. > > What I'd like to do is when the user logs in next time, a search will be > made to look at that users last login session info. If they didn't log > out properly, a notice will appear. > > So theoretically, I need to search for something like: > > "users current id -1" or their last time of visit. > > Here is the sql query that I have so far. But I think that I need to > remove the "self_logout='N'" because that doesn't show the actual last > result; rather it shows the last result where they didn't properly > logout. > > $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS > unixdate from logged_in WHERE (self_logout='N') AND > (userid='$current_user') ORDER BY id DESC LIMIT 1,1"; > > Here is my trimmed down table structure: > > CREATE TABLE logged_in ( > id tinyint(4) DEFAULT '0' NOT NULL auto_increment, > session varchar(100) DEFAULT '0' NOT NULL, > time_in timestamp(14), > time_out varchar(50) DEFAULT '-' NOT NULL, > self_logout char(1) DEFAULT 'N' NOT NULL, > KEY id (id) > ); > > Did that make any sense? To sum it all up, I just want to remind people > to click "logout" if they forgot the last time. > > Thanks for any suggestions!! > > __ > Jason Dulberg > Extreme MTB > http://extreme.nas.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] To > contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql query for current id-1
Hi, The reason probably is that you're limiting from the 2nd row, instead of the first, 0 is the row starting point (I think). So : $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS unixdate from logged_in WHERE userid='$current_user' ORDER BY id DESC LIMIT 0, 1"; = * Know more about me: http://www.geocities.com/mimodit * __ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mysql query for current id-1
What about this: $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS unixdate from logged_in WHERE userid='$current_user' ORDER BY id DESC LIMIT 1"; I think this should work for your case. Maxim Maletsky www.PHPBeginner.com -Original Message- From: Jason Dulberg [mailto:[EMAIL PROTECTED]] Sent: martedì 2 ottobre 2001 6.04 To: [EMAIL PROTECTED] Subject: [PHP] mysql query for current id-1 This is kindof a weird question so bear with me as I try to explain. I have a session table that gets updated when a user logs in/out. If they don't logout, some info is left unchanged. I have a cron script that takes care of the stray sessions so that's all good. In the sessions table, there's a field "self_logout" which is Y when they logout properly and N if the cron script removes their session. What I'd like to do is when the user logs in next time, a search will be made to look at that users last login session info. If they didn't log out properly, a notice will appear. So theoretically, I need to search for something like: "users current id -1" or their last time of visit. Here is the sql query that I have so far. But I think that I need to remove the "self_logout='N'" because that doesn't show the actual last result; rather it shows the last result where they didn't properly logout. $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS unixdate from logged_in WHERE (self_logout='N') AND (userid='$current_user') ORDER BY id DESC LIMIT 1,1"; Here is my trimmed down table structure: CREATE TABLE logged_in ( id tinyint(4) DEFAULT '0' NOT NULL auto_increment, session varchar(100) DEFAULT '0' NOT NULL, time_in timestamp(14), time_out varchar(50) DEFAULT '-' NOT NULL, self_logout char(1) DEFAULT 'N' NOT NULL, KEY id (id) ); Did that make any sense? To sum it all up, I just want to remind people to click "logout" if they forgot the last time. Thanks for any suggestions!! __ Jason Dulberg Extreme MTB http://extreme.nas.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]