Date

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
gigabayt
Forum Newbie
Posts: 3
Joined: Sat Aug 30, 2008 5:23 am

Date

Post by gigabayt »

Hi!

I want my members to see when their referral was logged in last. Right now it just shows 0000-00-00 I 've logged in and out but notjing seems to change, what is the problem? Why aren't php writing in my mysql database?

Thanks guys!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Date

Post by Christopher »

The login is just a select. You need to update the field with something like:

UPDATE mytable SET mydate=NOW() WHERE id='$id'
(#10850)
gigabayt
Forum Newbie
Posts: 3
Joined: Sat Aug 30, 2008 5:23 am

Re: Date

Post by gigabayt »

It posted before a login date, but it just looked like this: 665258945 Just some numbers, and now I want them to look like 2008-08-30

Login.php

Code: Select all

$lastlogdate=time();
I tried your code but I just get a white page with T_string problem :(
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Date

Post by Christopher »

You need to read up on the functions, but in the PHP and MySQL manual, that return timestamps and that return date strings.
(#10850)
Post Reply