Valhalla Legends Archive

Programming => Web Development => Topic started by: AC_Drkan on December 30, 2005, 09:16 AM

Title: Unixtimestamp question
Post by: AC_Drkan on December 30, 2005, 09:16 AM
In some scripts i found, im trying to recreate them, heres my problem.

SELECT TO_DAYS(NOW())-TO_DAYS(FROM_UNIXTIME(logindate)) FROM members WHERE id = $mid

im trying to figure out what to set logindats as in phpmyadmin. So far i have tried everything and have been unsuccessful. So my question is, i know what NOW() returns, and have tried to make it similar to logindate, but i can't seem to figure out this FROM_UNIXTIME function. If someone could help me out, it would be muchly appreciated.

It produces this:

Days Since Login: 13148
Days in Clan: 12916


I just got the scripts able to login yesterday, and im sure i have all the correct tables.


EDIT:
I found the error, the table just need to be listed as an int with 15 values, and somehow it works.


Days Since Login: 0
Days in Clan:            12917
Title: Re: Unixtimestamp question
Post by: rabbit on December 31, 2005, 09:30 AM
<?php    list($y_check, $m_check, $d_check) = split('[-]', $row['last_login']);    $y = date("Y");    $m = date("m");    $d = date("d");    $control = mktime(0, 0, 0, $m, $d, $y);    $check = mktime(0, 0, 0, $m_check, $d_check, $y_check);    $difference = $control - $check;    $dsl = floor($difference / 60 / 60 / 24);?>
At least...that's how I do it...