Checking if time is more/less then x |
[eluser]NyiPHP[/eluser]
I am working with a page counter, and it counts each time the same ip visits an article. Code: function enArtikkelTeller($artikkel_id) { the problem is at Code: if(strtotime($tid) > strtotime('- 1 minute')) { the time variable is saved on mysql with type: timestamp, on update CURRENT_TIMESTAMP, Standard: CURRENT_TIMESTAMP, Extra: ON UPDATE CURRENT_TIMESTAMP Im lost in how to solve this out. 1. i need to check if time is less/more and 2. i need to update the old time with new (current) time, if its less then x-minutes.
[eluser]Jan_1[/eluser]
I like working with unix time more, instead of MySQL-Timestamp-Format. May be it's a solution to you. But you would have to set your timestamp with INSERT/Update in your model. http://www.php.net/manual/en/function.time.php
[eluser]TheFuzzy0ne[/eluser]
I think you might be over-complicating things a little. I see no reason why strtotime() should need to be called more than once. Code: $sql_datetime = '2012-04-02 09:55:00';
[eluser]NyiPHP[/eluser]
Thank you very much! it works now Code: foreach ($query->result() as $row) |
Welcome Guest, Not a member yet? Register Sign In |