[PHP-DB] Getting rows where column has changed?

2002-10-27 Thread Leif K-Brooks
I'm trying to make a page to help in detecting people using automatic 
refresher programs.  In the table that stores user info, there is a 
column called lastseen which says when the user was last seen.  I'm 
trying to:
1. Select all lastseen colmns that are less than 5 minutes old
2. Wait 2 seconds
3. Select lastseen columns that have changed since step 1, and display 
that info
Any ideas on how to do this?  Is it even possible?  Thanks...

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Getting rows where column has changed?

2002-10-27 Thread Ignatius Reilly
How often in a day must you do this? Every 5mn?

Ignatius

- Original Message -
From: Leif K-Brooks [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 27, 2002 7:33 AM
Subject: [PHP-DB] Getting rows where column has changed?


 I'm trying to make a page to help in detecting people using automatic
 refresher programs.  In the table that stores user info, there is a
 column called lastseen which says when the user was last seen.  I'm
 trying to:
 1. Select all lastseen colmns that are less than 5 minutes old
 2. Wait 2 seconds
 3. Select lastseen columns that have changed since step 1, and display
 that info
 Any ideas on how to do this?  Is it even possible?  Thanks...

 --
 The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Getting rows where column has changed?

2002-10-27 Thread John W. Holmes
 I'm trying to make a page to help in detecting people using automatic
 refresher programs.  In the table that stores user info, there is a
 column called lastseen which says when the user was last seen.  I'm
 trying to:
 1. Select all lastseen colmns that are less than 5 minutes old
 2. Wait 2 seconds
 3. Select lastseen columns that have changed since step 1, and display
 that info
 Any ideas on how to do this?  Is it even possible?  Thanks...

Temp tables would probably work great here... I'm assuming mysql, but
the logic should work with any db. 

?
//untested code:

$result = mysql_query(CREATE TEMPORARY TABLE temp (PRIMARY KEY (id))
SELECT id, lastseen FROM table WHERE lastseen  NOW() - INTERVAL 5
MINUTE);

sleep(2);

$result = mysql_query(SELECT table.* FROM table, temp WHERE table.id =
temp.id AND table.lastseen != temp.lastseen);


Then parse the results of the second query and it should give you those
rows that have changed in 2 seconds. 

---John Holmes...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php