PDA

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



smansakra
12-03-2008, 09:05 AM
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

smansakra
12-04-2008, 09:11 AM
no answer BUT THIS below code work well
AND (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(date) < $delay*60 ) :)