Help with a PHP script

2 replies
Hello Friends


I'm trying to build a PHP function that gets the values of the first and second rows of a table and subtract them. Then the function gets the second and third values and subtract them, then the third and forth and so on until the end of the table. (The table will be sorted ASC and the value of the subtraction will be use for posterior use) Is this possible?


Thanks
#php #script
  • Profile picture of the author Bruce Hearder
    Can you give a simple example?

    Where is the data coming from, is it a database table, or array or whatever..

    A bit more data need first..

    Bruce
    {{ DiscussionBoard.errors[1823896].message }}
  • Profile picture of the author robertvance
    Have you thought about reading the data into an array.

    then loop through the arrays. as you loop through the first array use the index to read the values from the second array. save the values in a variable after the subtraction.

    Hope that helps.
    {{ DiscussionBoard.errors[1834315].message }}

Trending Topics