Jump to content

Grand Total Help Please


phpretard

Recommended Posts


// THIS IS HOW THE ARRAY SETS UP

Array
(
    [P1120081.jpg] => Array
        (
            [picture] => ALBUMS/Denis/P1120081.jpg
            [file] => P1120081.jpg
            [QU46] => 0
            [QU57] => 1
            [QU810] => 0
            [QU1114] => 2
            [QU1216] => 0
            [QU1620] => 0
            [QU2024] => 4
            [QU2030] => 0
            [order_photo] => Update This Order
        )

    [P1120082.jpg] => Array
        (
            [picture] => ALBUMS/Denis/P1120082.jpg
            [file] => P1120082.jpg
            [QU46] => 10
            [QU57] => 0
            [QU810] => 0
            [QU1114] => 13
            [QU1216] => 0
            [QU1620] => 0
            [QU2024] => 15
            [QU2030] => 0
            [order_photo] => Order This Photo
        )

)

//THIS ADDS THE TOTALS AND PUTS IT AN VAR CALLED $total

foreach ($_SESSION as $file => $val){

$P46=($_SESSION[$file]['QU46'] * 7);
$P57=($_SESSION[$file]['QU57'] * 10);
$P810=($_SESSION[$file]['QU810'] * 20);
$P1114=($_SESSION[$file]['QU1114'] * 40);
$P1216=($_SESSION[$file]['QU1216'] * 50);
$P1620=($_SESSION[$file]['QU1620'] * 60);
$P2024=($_SESSION[$file]['QU2024'] * 70);
$P2030=($_SESSION[$file]['QU2030'] * 80);

$total=($P46+$P57+$P810+$P1114+$P1216+$P1620+$P2024+$P2030);

}

echo GRAND TOTAL????

 

Somehow I need a grand total from this mess.

 

Any thought on this?

Link to comment
https://forums.phpfreaks.com/topic/102259-grand-total-help-please/
Share on other sites

//THIS ADDS THE TOTALS AND PUTS IT AN VAR CALLED $total
$grandtotal;
foreach ($_SESSION as $file => $val){

$P46=($_SESSION[$file]['QU46'] * 7);
$P57=($_SESSION[$file]['QU57'] * 10);
$P810=($_SESSION[$file]['QU810'] * 20);
$P1114=($_SESSION[$file]['QU1114'] * 40);
$P1216=($_SESSION[$file]['QU1216'] * 50);
$P1620=($_SESSION[$file]['QU1620'] * 60);
$P2024=($_SESSION[$file]['QU2024'] * 70);
$P2030=($_SESSION[$file]['QU2030'] * 80);

$total=($P46+$P57+$P810+$P1114+$P1216+$P1620+$P2024+$P2030);
$grandtotal += $total;
}

echo $grandtotal;

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.