• Welcome to ForumKorner!
    Join today and become a part of the community.

PHP Challenge #2

OliverE

Power member.
Reputation
0
Hey Guys, ive got another PHP Challenge for you.

I have a MySQL table with 2 columns and a large number of rows.
The first column is a unix timestamp and each row increments by 1 day which in Unix time is 86400 seconds.
The second column is a randomly generated integer value sumed to the value of the previous column

In theory each day or row has its own value thats summed to the previous cell, because this value isnt currently recorded down I need to add a row to that table called dailyvalue, each cell displays the amount added to the previous value to get to the current value.

If you havent grasped it yet:
dailyvalue = current row value - previous row value

Heres a example of the end result created in Excel: [attachment=135]

Dont forget that all I require is the last column (dailyvalue). Everything else has already been created. All your doing is subtracting the current value from the value in the previous cell and putting it into the cell to the right of it.

Let me know if you have any questions, I know I make this sound so much more complex than it seems.

Thanks
 

Factor8™

Active Member
Reputation
0
This makes absolutely no sense whatsoever.
 

OliverE

Power member.
Reputation
0
All you got to do is fetch values from a row from a table in MySQL subtract the values by the previous value and the post them to a new row in the same table.

So instead of having a running total of values, you have each seperate value.

Ill try and think of an example.