I have a tricky problem that I am sure that you guru'swill think is fairly straight forward.
I have a table of Actions with a Time Stamp and a support ID. These were imported from another DB which only allowed 250 chars per line so many of the actions are actually meant to be 1 action it is just the limitation forced the user to enter new lines and therefore create a new action (new record).
What I want to do is to grab the records in the DB based on the support ID which I know how to do, but then I want to start with the very first entry returned (sorted on the timestamp) get its timestamp and compare it with the preceeding records to see if the next entry was enetered wihtin 600 seconds (10 minutes) of the currently returned result. If it was then concatenate the action decription and insert them into the new table I have ready and waiting.
So in pseudo.
Grab all the results based on the support ID.
Get the timestamp of the first returned record.
Go to the next result in the set compare its timestamp with the previous record.
If the difference is less than 600 seconds then concatenate the action strings, then step to the next record and repeat until the timestamp difference is greater than 600 seconds.
If the difference is greater than 600 then insert the record into the new table. Skip any records that have already being concatenated and move to the next record and repeat the timestamp check process until there are no more results.
Hmm sounds easy when I say it like this but I have tried to do this and I have gotten in rather a mess. Im not going to post it since it does not work and it looks like the code of a small child
Please someone help me out here, im lost in a sea of arrays, loops and debug echo statements.