By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,893 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Unix timestamp update

P: n/a
Hello,

I'm creating login using PHP/MySQL. I have Unix Timestamp (eg.
1005882301). What will be the easiest way to update this filed to
current date/time everytime when user log in? Should I rather use some
other mysql date/time field type?

TNX

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
dr zoidberg wrote:

I'm creating login using PHP/MySQL. I have Unix Timestamp (eg.
1005882301). What will be the easiest way to update this filed to
current date/time everytime when user log in? Should I rather use some
other mysql date/time field type?


if (/*User login is successful*/)
mysql_query("UPDATE accounts SET lastlogin = ".time()." WHERE userid =
$userid");

Change variables and use security checks as appropriate.

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2

P: n/a
I noticed that Message-ID: <IS*****************@ns45.bih.net.ba> from dr
zoidberg contained the following:
I'm creating login using PHP/MySQL. I have Unix Timestamp (eg.
1005882301). What will be the easiest way to update this filed to
current date/time everytime when user log in? Should I rather use some
other mysql date/time field type?


strtotime("now") is pretty easy.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3

P: n/a
On 2004-03-10, dr zoidberg <us**@domain.invald> wrote:
Hello,

I'm creating login using PHP/MySQL. I have Unix Timestamp (eg.
1005882301). What will be the easiest way to update this filed to
current date/time everytime when user log in? Should I rather use some
other mysql date/time field type?


Just use mysql's NOW() function.

UPDATE table SET timestamp=NOW() WHERE user_id=$user_id

--
http://home.mysth.be/~timvw
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.