function outputFilterBrand($dbAdapter)
{
    $gateBrands = new DeviceBrandTableGateway($dbAdapter);
    $result = $gateBrands->findAllSorted(name);
    foreach ($result as $row) {
        echo '<option value="' . $row->id . '">';
        echo $row->name;
        echo '</option>';
    }
}
<body>
<h1> Table Gateways Tester </h1>

<?php 
echo '<hr/>';
echo '<h2>Test BrowserTableGateway</h2>';
echo '<h3>Test findAll()</h3>';
$gate = new BrowserTableGateway($dbAdapter);
$result = $gate->findAll();
foreach ($result as $row) {
    echo $row->id . " - " . $row->name . "<br/>";
}
echo '<h3>Test findById(3)</h3>';
$gate = new VisitsTableGateway($dbAdapter);
$result = $gate->findByBrowserPercent();
foreach ($result as $row) {
    echo "['" . $row->name . "', " . $row->num . "],";
}
echo '<hr/>';
echo '<h2>Test DeviceBrandTableGateway</h2>';
echo '<h3>Test findAllSorted()</h3>';
$gate = new DeviceBrandTableGateway($dbAdapter);
$result = $gate->findAllSorted(true);
foreach ($result as $row) {
    echo $row->id . " - " . $row->name . "<br/>";
}
echo '<h3>Test findById(11)</h3>';
$result = $gate->findById(11);
echo $result->id . " - " . $result->name;
// all done close connection
$dbAdapter->closeConnection();
<?php

include 'partials/header.php';
require_once 'code/lib/helpers/visits-setup.inc.php';
$browserGate = new BrowserTableGateway($dbAdapter);
$visitGate = new VisitTableGateway($dbAdapter);
$continentGate = new ContinentTableGateway($dbAdapter);
$countryGate = new CountryTableGateway($dbAdapter);
$brandGate = new DeviceBrandTableGateway($dbAdapter);
$brandResult = $brandGate->findAllSorted(true);
$browserResult = $browserGate->findAllSorted(true);
$visitsByBrowser = $visitGate->getCountPercentageBy('browser_id');
$visitsByBrand = $visitGate->getCountPercentageBy('device_brand_id');
$continentResult = $continentGate->findAllSorted(true);
$dbAdapter->closeConnection();
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<div class="mui-row">
    <div class="mui-col-md-6">
        <div class="mui-panel left top">
		
		<!-- Dashboard Panel 1: Percentage of Visits by Browser -->

		<?php 
echo "<table class='mui-table' id='testtable'><thead><tr><th>Browser</th><th>Percentage of Visits</th></tr></thead><tbody>";
foreach ($visitsByBrowser as $row) {
    $browser = $browserGate->findById($row['browser_id']);
    echo "<tr><td>" . $browser->name . "</td><td>" . $row['percentage'] . "%</td></tr>";
}
echo "</tbody></table>";
?>
function outputDevice($dbAdapter)
{
    $gateBrands = new DeviceBrandTableGateway($dbAdapter);
    $result = $gateBrands->findAllSorted(name);
    echo json_encode($result);
}