Thanks for the reply, but the Timestamp(14) column (log_time) in my DB saves
the time as '20011018134612' this is the same format as the NOW()+0 I think?
I have tried various methods to get this to work. I've gone through the
manual and various books I have here but am having no joy at all.
I have spent far too much time on this, it really should be quite
straightforward to compare against a Timestamp column!! If anyone else has
----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: "p.whiter" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, October 18, 2001 3:43 PM
Subject: Re: [PHP-DB] newbie - problems with Select and timestamp(14)
: On Thursday 18 October 2001 18:41 pm, p.whiter 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
: I think you'll find NOW() to be the wrong function to use, as per
: Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'
: or YYYYMMDDHHMMSS format, depending on whether the function is used in
: a string or numeric context:
: mysql> select NOW();
: -> '1997-12-15 23:50:26'
: mysql> select NOW() + 0;
: -> 19971215235026
: As you can see what it returns is clearly unsuitable for what you have
: in mind. Your best bet is probably to use UNIX_TIMESTAMP().
: Jason Wong
: Gremlins Associates
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
: To contact the list administrators, e-mail: [EMAIL PROTECTED]
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]