Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: date question

  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    date question

    Hello everyone

    ok i have a small problem which is really irritating.

    I have a column in my db called online which has the time the user last clicked a link anywhere on the site. The date is then entered / updated in the following format. <?php echo date('D jS M Y :: G:i a');?>
    which displays it like Wed 20th Oct 2004 :: 3:01 am

    What i am trying to do is create a snippet of code so that on my admin page i can click a button and it will check the users table and look at the timeonline and if it is less than 30 minutes since it was updated ( ie since a link was clicked ) then it would reset their status to offline.

    can anyone help with the snippet as i am stuck.

    thank you

  • #2
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think your query would be like this:
    Code:
    UPDATE `user_table`
    SET `status` = 'offline'
    WHERE ADDDATE(`last link`, INTERVAL MINUTE 30) < CURTIME()
    "There is more than one way to do it."

  • #3
    New Coder
    Join Date
    Oct 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    thanks for your reply.

    i assume i understood correctly.
    i tried the following query
    $oflquery = "UPDATE `userss` SET `status` = 'offline' WHERE ADDDATE(`lastclick`, INTERVAL MINUTE 30) < CURTIME()";

    nothing happens .. just gives me a syntax error


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •