I am trying to add some numbers from a table.

$total = $total + $select_member['cash'];
echo $total;

It shows how it added it together. i only want the final number.

    The code you've shown looks fine, but since we have know way of knowing what the value of $total or $select_member['cash'] is, we have no way of knowing what the result should be. If you are not getting the expected result, then try doing a var_dump() of each variable to see what their values really are versus what you think they are.

      well say cash is

      15
      20
      25

      the page will display
      15
      35
      60

      i only want it to say 60 i don't care about the rest of them

        Is this in some sort of loop or something? If so, move the echo to after the end of the loop. If not, then you probably need to show us more of the code so we understand what's going on.

          Write a Reply...