- number_format: documentation ( source)
<?php
// Display the platform scores added together
$database = new PDO('mysql:host=db452664775.db.1and1.com;dbname=db452664775;charset=utf8', 'dbo452664775', '$h13ld@l13n');
//read the android scores from the MYSQL database
$query = $database->prepare("SELECT * FROM `MinionTotalsAndroid` WHERE 1");
$query->execute();
$android = $query->fetchAll();// as $android;
echo ($android[scoreTotal]);
//read the iphone scores from the MYSQL database
$query2 = $database->prepare("SELECT * FROM `MinionTotalsiPhone` WHERE 1");
$query2->execute();
$iOS = $query2->fetchAll();// as $iOS;;
//calculate the Accuracy to 2 decimal places
//number_format( (($android['rktsHit'] + $iOS['rktsHit'] ) / ( $android['rktsFired'] + $iOS['rktsFired'])) * 100, 2);
echo ($android['scoreTotal'] + $iOS['scoreTotal']) . '-'
.($android['junkTotal'] + $iOS['junkTotal']) . '-'
.($android['shpKlldByAstrd']+ $iOS['shpKlldByAstrd']) . '-'
.($android['shpKlldBySatlt']+ $iOS['shpKlldBySatlt']) . '-'
.($android['shpKlldByWrm'] + $iOS['shpKlldByWrm']) . '-'
.($android['shpKlldByPrt'] + $iOS['shpKlldByPrt']) . '-'
.($android['deathsTotal'] + $iOS['deathsTotal']) . '-'
.($android['minKlldByAst'] + $iOS['minKlldByAst']) . '-'
.($android['minKlldBySatlt']+ $iOS['minKlldBySatlt']) . '-'
.($android['minKlldByWrm'] + $iOS['minKlldByWrm']) . '-'
.($android['minKlldByPrt'] + $iOS['minKlldByPrt']) . '-'
.($android['deathsTotal'] + $iOS['deathsTotal']) . '-'
.($android['shldUsd'] + $iOS['shldUsd']) . '-'
.($android['shldDstryd'] + $iOS['shldDstryd']) . '-'
.($android['hmngUsd'] + $iOS['hmngUsd']) . '-'
.($android['pwrUsd'] + $iOS['pwrUsd']) . '-'
.($android['rktsFired'] + $iOS['rktsFired']) . '-'
.($android['rktsHit'] + $iOS['rktsHit']) . '-'
.($android['rktsMssd'] + $iOS['rktsMssd']) . '-'
.(number_format( (($android['rktsHit'] + $iOS['rktsHit'] ) / ( $android['rktsFired'] + $iOS['rktsFired'])) * 100, 2)) . '-'
.($android['astKlldByShp'] + $iOS['astKlldByShp']) . '-'
.($android['astrdKlldByMin']+ $iOS['astrdKlldByMin']) . '-'
.($android['astrdEscp'] + $iOS['astrdEscp']) . '-'
.($android['astrdKlls'] + $iOS['astrdKlls']) . '-'
.($android['satltKlldByShp']+ $iOS['satltKlldByShp']) . '-'
.($android['satltKlldByMin']+ $iOS['satltKlldByMin']) . '-'
.($android['satltEscp'] + $iOS['satltEscp']) . '-'
.($android['satltKlls'] + $iOS['satltKlls']) . '-'
.($android['wrmKlldByShp'] + $iOS['wrmKlldByShp']) . '-'
.($android['wrmKlldByMin'] + $iOS['wrmKlldByMin']) . '-'
.($android['wrmKlls'] + $iOS['wrmKlls']) . '-'
.($android['prtKlldByShp'] + $iOS['prtKlldByShp']) . '-'
.($android['prtKlldByMin'] + $iOS['prtKlldByMin']) . '-'
.($android['prtKlls'] + $iOS['prtKlls']);