[eluser]Richard Schumann[/eluser]
hi, i am richard and realy new to oop - i am addicted and wanna learn like the hell but for this problem what i even dont know how to call it in progammers language - i cant find a nice solution - may someone wanna give me some breakthrough to this ?
let me say i have a table ID(autoinc), VALUE(some numbers like 100,99,77 ...)
CONTROLLER
Code:
$this->db->from('table');
$data['query'] = $this->db->get();
VIEW
Code:
<?php foreach ( $query->result() as $row ): ?>
<?=$row->value?>
<?php endforeach; ?>
how would you best calculate and output the difference from one row to another to have a result like this :
99
+1
98
+28
70
-5
75
-35
40 -
- how to know / trigger next row result in foreach-loop to calc that direct in view ?
- or : how to prepare the array to add another field with the difference in controller?
thanks for your help