MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Bastian Balthazar Bux Date:August 15 2005 8:47pm
Subject:Re: unix timestamp
View as plain text  
Sebastian wrote:
> i have this query:
> 
> SELECT COUNT(*) AS score FROM downloads WHERE date_add(dateline,
> interval 1 hour) >= now() GROUP BY filename ORDER BY score DESC
> 
> unfortunately for other reasons i had to change `dateline` to unix
> timestamp so this query is no longer able to run as intended. can anyone
> help with a work around?
> btw, i am using php to run queries if that helps find a solution.
> 
> 
If the database server and the webserver are not on the same box you
probably should use the same source for the timestamps.

Translated in plain english the insert query is created on the downloads
 server and don't use MySQL function to insert the date you should use
php time() function to retrieve your data.

$sql="
SELECT COUNT(*) AS score
FROM downloads
WHERE dateline >= " . (time() - 3600) . "
GROUP BY filename
ORDER BY score DESC
";

Also in a ntp syncronized network a difference of one or two second is
not unusual.
Thread
unix timestampSebastian15 Aug
  • Re: unix timestampSGreen15 Aug
  • Re: unix timestampChris15 Aug
  • Re: unix timestampScott Gifford15 Aug
    • Re: unix timestampKeith Ivey15 Aug
      • Re: unix timestampScott Gifford15 Aug
  • Re: unix timestampBastian Balthazar Bux15 Aug