You might want to first find lastlength before running the update query.

----- Original Message ----- 
From: "Siim Einfeldt aka Itpunk" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 2:25 AM
Subject: dealing with datetime


> 
> Hi,
> 
> Just working here on a php-mysql project and came to a weird problem, See
> this:
> 
> mysql_query("UPDATE trackvisits SET
> hitcount=hitcount+1,refreshtime=now(),lastlength=now()-arrivetime WHERE
> username='$visitor'");
> 
> Especially notice the lastlength=now()-arrivetime . Both lastlength and
> arrivetime are datetime fields, so at least in theory this query should
> update the lastlength field and set it to the right value
> (=now()-arrivetime), but it actually just sets the lastlength value to
> 0000-00-00 00:00:00 . The arrivetime does have just a bit smaller value
> than now(), at least some minutes.
> 
> Any idea why this might not work?
> 
> Thanks
> Siim EInfeldt
> Itpunk music Web
> www.itmusicweb.co.uk
> 
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to