OK so I have a table like this
Col1 Col2
10 30
20 40
50 60
I am querying the data like so
Query = ("SELECT * FROM TableName");
while ( $row= Mysql_fetch_array($query)) {
// code will go here
Code needs to get the prev row and the current row for every row in the table like:
This row['col1'] - prev row['col1'] = $wahatever
echo $whatever
}
I dont know whow to reference the prev row in php so as it looks through the while statment I need to say col1 - prev col1 and col2 - prev col2
Can Anyonw tell me how to do this. Its actually for working out complex mapping distcances which I can do, just cant work out how to call the prev rows data in the loop.
Any help would be greatfully apprceiated
Thanks for all your help but I dont think I asled the question properly.
What I am looking for is for a way to get each row and then minus col1 from col1 on the prev row and run through a loop untill the end.