Welcome Guest, Not a member yet? Register   Sign In
How can i use variable from diffrent foreach to get value by adding 2 variable itself
#4

(09-28-2015, 05:18 PM)JayAdra Wrote: Declare your variables outside of the foreach loop.


PHP Code:
$untung 0;
$ongkir 0;

foreach (
$sum->result() as $row) {
 
 $untung=$row->jumlah_item   
}

foreach (
$sumongkir->result() as $row) {
 
 $ongkir=($row->total);
}

$total=$untung+$ongkir
Smile Thanks jay, i guess also but need someone guide me to debug it ! big thanks and +1 for you, May God bless you
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB