I have 4 columns each containing a number. I need the echo
to output in such an order, that the row with the biggest sum of numbers (from each of the 4 columns) is the first.
For example:
1)id1|1 |10|1 |2|
2)id2|3 |12|43|1|
3)id3|12|0 |1 |1|
After ordering:
1)id2|3 |12|43|1
2)id1|1 |10|1 |2
3)id3|12|0 |1 |1
One option is to make a "sum" column... but that would require updating it each time one of the numbers in one of the columns changes... Is there a more simple solution?
For example, I output the sum of numbers of each id
when it is displayed in a single <div>
, I add them with a function before outputing the <div>
.