Check if php mysql query result column is empty
<p>I'm printing out a table with 27 cols from a database, so its obvious that it'll be aesthetically displeasing if 27 cols were visible on my screen. so this is one of the conditions i've been using to see if a particular col is empty, if it is empty then the table header will not be printed and if that isnt printed another if isset condition will not print the table data. But it isn't working out as planned. These are the variations i've tried and none of them are working P.S. $result = number of rows being returned by the query. </p>

<pre><code>$i = 1;
while ($i &lt;= $result)

    {
        if (!empty($array['Others'][$i]))
            {

                $others = print "&lt;th&gt;Others&lt;/th&gt;";
                break;
            }
        $i++;
    }


$i = 0;
    while ($i &lt;= $result)
    {
        $emptyothers = !empty($array['Others'][$i]);

        if ($emptyothers == '1')
            {

                $others= print "&lt;th&gt;Others&lt;/th&gt;";
                break;
            }
        $i++;
    }   
</code></pre>
