Results 1 to 2 of 2

Thread: stop submiting input if his last input submitted less than one minutes ago. HOW?

  1. #1
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default stop submiting input if his last input submitted less than one minutes ago. HOW?

    hello....
    how to stop submitting user's input, if his last input was submitted less then one minute ago.

    please see this mysql sturcture

    table SMANSAKRA
    ID | text_input | date

    the "date" here is "NOW()" value when the user submit his input.

    i want to select the user input that submitted more than one minutes ago by using this code,
    but never success:


    // db_arr is a function from other file
    $delay = 1;
    $count_arr = db_arr("SELECT COUNT( * ) AS `my_count` FROM `shoutbox` WHERE `id` = '$id' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(date)) < $delay ");

    if ( $count_arr['my_count'] == 0 ) echo "congratulations you can submit to database";
    else echo "please wait until 1 minutes";

    BUT , it always display "please wait until 1 minutes" although it had been more than 2 minutes

    can anyone help me to fix code above ...? thanks
    ///////////////////////////////////////////////////
    ///// http://www.mediatutorial.web.id
    ///////////////////////////////////////////////////

  2. #2
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default no answer

    no answer BUT THIS below code work well
    AND (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(date) < $delay*60 )
    ///////////////////////////////////////////////////
    ///// http://www.mediatutorial.web.id
    ///////////////////////////////////////////////////

Bookmarks

Posting Permissions

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