$productQuery = urlencode($productQuery);
    $productJson = file_get_contents("http://220.132.97.119:3030/mydata/query?query={$productQuery}&output=json&stylesheet=");
    $product = json_decode($productJson, true);
    echo "<div class='panel-body'>";
    echo ' <table class="table table-striped table-bordered table-hover">
            <thead>
                <tr>
                    <th width="10%">#</th>
                    <th>商品類別(商品總數)</th>
                </tr>
            </thead>
            <tbody>';
    for ($j = 0; $j < count($product["results"]["bindings"]); $j++) {
        $pro = $product["results"]["bindings"][$j]["about"]["value"];
        $pro = str_replace("http://db#", "", $pro);
        $getId = getCategoryIdBySearch($conn, $pro);
        $catid = (int) $getId[0][0];
        $getCount = getCategoryCountByCatidSearch($conn, $catid);
        echo "<tr><td>" . ($j + 1) . "</td>";
        echo "<td><a href='http://220.132.97.119/dashboard/category.php?id=" . $getId[0][0] . "'>{$pro}(" . $getCount[0][0] . ")</td></tr>";
    }
    echo "</tbody></table>";
    if (count($product["results"]["bindings"]) == 0) {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        echo "No product.";
    }
    echo "</div></div>";
}
?>
</div>
$json = file_get_contents("http://220.132.97.119:3030/mydata/query?query={$myquery}&output=json&stylesheet=");
$obj = json_decode($json, true);
echo ' <table class="table table-striped table-bordered table-hover">
            <thead>
                <tr>
                    <th width="10%">#</th>
                    <th>商品類別(總數)</th>
                </tr>
                </thead><tbody>';
if (count($obj["results"]["bindings"]) == 0) {
    echo "Nothing to query.";
}
for ($i = 0; $i < count($obj["results"]["bindings"]); $i++) {
    $item = $obj["results"]["bindings"][$i]["about"]["value"];
    $item = str_replace("http://db#", "", $item);
    $getId = getCategoryIdBySearch($conn, $item);
    $catid = (int) $getId[0][0];
    $getCount = getCategoryCountByCatidSearch($conn, $catid);
    echo '<tr><td>' . ($i + 1) . '</td>';
    echo " <td><a href='http://220.132.97.119/dashboard/category.php?id=" . $getId[0][0] . "'>{$item}(" . $getCount[0][0] . ")</td></tr>";
}
?>
</div>
</div>


<?php 
include_once "footer.php";
?>