PHP Classes

Looking for row changes

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Looking for row changes  
Subject:Looking for row changes
Summary:PHP & MYSQL
Messages:5
Author:Steve Warburton
Date:2009-05-09 08:52:21
Update:2009-05-12 19:02:27
 

  1. Looking for row changes   Reply   Report abuse  
Picture of Steve Warburton Steve Warburton - 2009-05-09 21:47:25
We have a server application (written by a third party that we cannot change). This listens to a camera and recives an image / status change and populates a MYSQL table with the image / status changes.

I need to action some PHP code when an image arrives or a status changes.

I know I can do a query every 5 secs and extract any changes. I am worried this will produce a big overhead as the tables have 1000,000' of rows.

My idea was to use a 'trigger' on a row change and place this change into another table (TEMP_1).

I would then poll TEMP_1 action the PHP then remove the data to STORED_1.

This would keep the size of TEMP_1 down as a row is deleted after it is processed.

If the above would work what is the syntax of the trigger to do:

SELECT ('COLUMN CHANGED' & 'ROW_ID') from MAIN_TABLE TO TEMP_1

So TEMP_1 would have

STATUS_CHANGE ROW_ID
NEWIMAGE 567

The PHP code would then poll the above and send a message to user 567 via SMS that a new image has arrived.

Or is there another approach to this.

There are 4 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.