• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i use variable from diffrent foreach to get value by adding 2 variable itself

#1
Hello guys, now i have little problem that spend my time not to hard but don't know how to solved this, here is my view
Code:
<?php
foreach ($sum->result() as $row) {  ?>

$untung=$row->jumlah_item;    

<?php  }  ?>



<?php
foreach ($sumongkir->result() as $row) {  ?>

$ongkir=($row->total);

<?php  }  ?>


$total=$untung+$ongkir; //it doesn't working, what do i wrong here? please guide me to debug it, thanks
Reply


Messages In This Thread
How can i use variable from diffrent foreach to get value by adding 2 variable itself - by freddy - 09-28-2015, 04:44 PM
Declare variables outside of loop - by JayAdra - 09-28-2015, 05:18 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.