Php - Omit columns in an array, with in another array

This is a fun one.

I have a function that produces an array from mySQL...or better yet, it produces an array of arrays. Follow?

I've figured out how to drill down in to the array to display them into a working table. As so:

<table id="list_table" cellpadding="1" cellspacing="1">

<?php
    $array = $this->disparray;

    foreach($array as $key => $value)
        {
            echo '<tr>';
            foreach($value as $key => $value)
                {
                    echo '<td>' .  $value . '</td>';
                }
            echo '</tr>';
        }

?>
</table>

HOWEVER, I only want to call specific <td>'s, which means, I have to call references to the specific column indexes. I've tried $value['1'], but it just does some crazy stuff. so, where I'm stuck is I do not know where to call the specific column indexes that I want.


You're nesting/overwriting your $key and $value variables. That is likely completely messing things up.

Try:

<?php
$array = $this->disparray;

foreach($array as $key => $value)
    {
        echo '<tr>';
        foreach($value as $k => $v)
            {
                echo '<td>' .  $v . '</td>';
            }
        echo '</tr>';
    }

?>

That might help you solve your issues.