while ($x < count($array)) {
    //$category = getItemCategory($array[$x]['id']);
    ?>
    <div class="tab-pane fade <?php 
    if ($x == 0) {
        ?>
active<?php 
    }
    ?>
 in" id="<?php 
    echo strtolower($array[$x]['category']);
    ?>
" >
    <?php 
    /* category content default limit is 4 */
    $items = getSearchItems("category", $array[$x]['category'], null, null);
    //$rs = $mysqli->query("SELECT * FROM items where category='".$array[$x]['category']."' and active='1' order by date_created desc limit 4") or die(mysql_error());
    //echo "SELECT * FROM items where category='".$array[$x]['category']."' and active='1' order by date_created desc limit 4";
    $i = 0;
    $limit = 8;
    /* set max loop value */
    if ($limit < count($items)) {
        $max = $limit;
    } else {
        $max = count($items);
    }
    while ($i < $max) {
        $bits = explode('.', $items[$i]['img']);
        ?>
    <div class="col-sm-3">
        <div class="product-image-wrapper">
    } else {
        $content2 = null;
    }
} elseif ($price != '') {
    $mode = "price";
    $content = $price;
} elseif ($search != '') {
    $mode = "search";
    $content = $search;
} else {
    /* unknown mode & content */
    $mode = '';
    $content = '';
}
/* get searched items */
$array = getSearchItems($mode, $content, $content2, null);
/* if no results found */
if (count($array) <= 0) {
    ?>
<div>
    <div class="col-xs-3 col-sm-3 col-md-3">
        <div class="product-image-wrapper">
    		<div class="single-products">
    	       	<div class="productinfo text-center">
    				<p><?php 
    echo "No Results";
    ?>
</p>
    			</div>
    		</div>
        </div>