Div not to display if no results found -
<p>I have an area on my page of coloured swatches (and the tile AVAIALBLE COLOURS) that i only want to display if there is a result for them in the database. </p>

<p>here is my code:</p>

<pre><code>private function getWTVariationHighlights($productId, $variationId)
{
    $output_str = "";
    $output_str .="&lt;div class=\"mainProductSwatchesTitle\"&gt;&lt;b&gt;AVAILABLE COLOURS&lt;/b&gt;\n";
    $output_str .= "&lt;div class=\"mainProductSwatches\"&gt;\n";
    $sql = "select voptionid, vovalue from [|PREFIX|]product_variation_options where vovariationid=$variationId and (voname='Colour' or voname='Color')";
    $result = $this-&gt;db-&gt;Query($sql);
    while ($row = $this-&gt;db-&gt;fetch($result)) {
        $sql = "select * from [|PREFIX|]variation_option_highlight where variation_option_id=" . $row['voptionid'] . " and product_id=" . $productId;
        $result2 = $this-&gt;db-&gt;Query($sql);
        if($row2 = $this-&gt;db-&gt;fetch($result2)){
            if($row2['thumb_location']){
                $output_str .= "&lt;a href=\"#\" onmouseover=\"changeMain('" . $row2['location'] . "')\"&gt;&lt;img src=\"" 
                    . $GLOBALS['ShopPath'] . "/product_images/hfh_highlight_images/" . $row2['thumb_location'] . "\" /&gt;&lt;/a&gt;\n";
            }
        }
    }
    $output_str .= "&lt;/div&gt;\n";
    $output_str .= "&lt;script type=\"text/javascript\"&gt;\n";
    $output_str .= "function changeMain(src)\n";
    $output_str .= "{\n";
        $output_str .= "document.getElementById('phthumb').src = '" . $GLOBALS['ShopPath'] . "/product_images/hfh_highlight_images/' + src;\n";
    $output_str .= "}\n";
    $output_str .= "&lt;/script&gt;\n";

    return $output_str;
}
</code></pre>
