Re: newbie - problems with Select and timestamp(14) calculation
| From: | Russ Michell | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: newbie - problems with Select and timestamp(14) calculation | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13480@lists.php.net to get a copy of this message | ||
Take a good look at the manual page, it helped me out a bunch of times:
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
Good luck.
Russ
On Thu, 18 Oct 2001 14:02:34 +0100 "p.whiter" <p.whiter@0800dial.com> wrote:
> Hi
> Thanks for your reply, I have tried this using NOW() and NOW()+0, there is
> no difference, I think I have narrowed the problem down to the time part of
> the timestamp being disregarded, as I have written the query below it is
> making the calculation using days rather than seconds......
>
> This should really be a rather simple query to achieve, but it is turning
> into a big headache.....
>
> Thanks again
> Paul
>
> ----- Original Message -----
> From: "Russ Michell" <r.j.michell@apu.ac.uk>
> To: "p.whiter" <p.whiter@0800dial.com>
> Cc: <php-db@lists.php.net>
> Sent: Thursday, October 18, 2001 12:24 PM
> Subject: Re: [PHP-DB] newbie - problems with Select and timestamp(14)
> calculation
>
>
> : >(NOW()+0)
> : Not sure what the +0 achieves?? Try with just NOW().
> :
> : Cheers.
> : Russ
> :
> : On Thu, 18 Oct 2001 11:41:14 +0100 "p.whiter" <p.whiter@0800dial.com>
> wrote:
> :
> : > Hi
> : > I am trying to set-up a type of anti-flood block on one of my forms, the
> way
> : > I am doing this is that when the first submission is made I log various
> : > details into a user_log table including IP no and a Timestamp (14)
> column
> : > called log_time. Now if the button is clicked again the php script will
> run
> : > the following query:
> : >
> : > SELECT user_ip FROM clinic_log WHERE user_ip = '$pw_userIP' AND
> : > (((NOW()+0) - clinic_log.log_time ) < 300)
> : >
> : > What I am (trying) doing here is to check the users IP ($pw_userIP)
> against
> : > the user_ip column in the database and if it matches then check to see
> : > whether it has been there for less than 300 seconds.
> : >
> : > I have just spent the last couple of hours trying to get this
> : > working......it doesn't want to know. It keeps finding the matching IP
> and
> : > disregarding the time calculation......
> : >
> : > Thanks for any help.
> : > Paul
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: r.j.michell@apu.ac.uk
w: www.apu.ac.uk/webteam
www.theruss.com
#-------------------------------------------------------#