display empty/blank table if query returns false
<p>what would be the proper implementation of displaying an empty/blank table or just the table header if query result is empty?  </p>

<p>**note/conditions<br>
no page redirection<br>
no creation of two tables, one for query with empty result and one for query with results  </p>

<p>or is there a much, much  better way to do this?<br>
here is a sample code:  </p>

<pre><code>&lt;?php if(isset($result)){ ?&gt;  
&lt;table&gt;
&lt;tr&gt;
    &lt;td&gt;Name&lt;/td&gt;
    &lt;td&gt;Email&lt;/td&gt;
&lt;/tr&gt;  

&lt;?php foreach($result as $key =&gt; $data){?&gt;
&lt;tr&gt;  
    &lt;td&gt;&lt;?php echo $data['name'];?&gt;&lt;/td&gt;  
    &lt;td&gt;&lt;?php echo $data['email_add'];?&gt;&lt;/td&gt;   
&lt;/tr&gt;   
&lt;?php }?&gt;
&lt;/table&gt;
&lt;?php } ?&gt;
</code></pre>

<p>the problem here is that it still throws an error on foreach loop.    </p>
