Last Login [PHP & MYSQL]

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Please avoid all the above code. mysql_* functions are deprecated. Check out MySQLi or PDO instead.
The MySQL functions are deprecated and, from my understanding, soon be removed from newer versions of PHP so it's best for him to traverse now. But let's not get bogged down in what method to use.
It's likely you don't actually have a constant defined as USER_ID. I'm assuming Jay wanted you to change that to whatever variable your user ID is called

Also, the whole 'strtotime' line is useless because if you're storing time() in the LastLogin column, it'll already come out as a UNIX time stamp so essentially you'll be converting a UNIX time stamp to a UNIX time stamp, which I guess may give you a different value? Not sure. So you can remove that line
Yes, I actually didn't know how to do this, it took me about 5-10 minutes to ramble up some quick code. That wasn't suppose to be copy and paste, it was suppose to be build off of this.
 

Users who are viewing this thread

Top