ideal method of building tables in PHP
<p>As an intern I realized that I spend the bulk of my time building and manipulating tables from sql queries in PHP. My current method is to use two foreach loops:</p>

<pre><code>foreach($query as $record){
    foreach($record as $field =&gt; $value){
        *Things that need to be done on each field-value pair*
    }
    *Things that need to be done on each row*
}
</code></pre>

<p>Is there a better way of doing this?</p>

<p>Also I tend to pack data together as a ~ separated list and store it in the server, is this a bad practice?</p>

<p>I'd rather put some code up for review but I don't want to risk exposing the internals of the company cod.</p>
