how do i add columns to these database tables or add whole new database table then insert results in appropriate html table cells?
<p>users table:</p>

<pre><code>id | name
----------
1  | admin
2  | brian
3  | frank
4  | wendy
</code></pre>

<p>chore_list table:</p>

<pre><code>id | chore
----------
1  | cleaned coffee table
2  | vacuumed rug
3  | did dishes
</code></pre>

<p>HTML table:</p>

<pre><code>------------------------------------------------
| chores               | brian | frank | wendy |
------------------------------------------------
| Cleaned coffee table | -     | -     | -     |
------------------------------------------------
| Vacuumed rug         | -     | -     | -     |
------------------------------------------------
| Did dishes           | -     | -     | -     |
------------------------------------------------
</code></pre>

<p>Everything is dynamic, except the dashes. Also I have it not selecting admin. I would like to know what the best way to extend the tables I have and/or create new table so that I can dynamically insert where the dashes are the amount of times each person did a particular chore.  Here is what I have so far...</p>

<pre><code>&lt;?php
$result=$dbcon-&gt;query("SELECT name FROM users WHERE id != 1 ORDER BY name ASC");
$result_chores=$dbcon-&gt;query("SELECT chore FROM chore_list");
$x = $result-&gt;num_rows;
//echo $x; //test
echo "
&lt;table id='choretable'&gt;
    &lt;thead&gt;
        &lt;tr&gt;";
            echo "&lt;th&gt;chores&lt;/th&gt;";
            while($row=$result-&gt;fetch_array()){
                echo "&lt;th&gt;".$row['name']."&lt;/th&gt;";
            }
        echo "
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;";
        while($row_chores=$result_chores-&gt;fetch_array()){
            echo "
            &lt;tr&gt;";
                echo "&lt;td&gt;".$row_chores['chore']."&lt;/td&gt;";
                $y = 1;
                while($y &lt;= $x) {
                    echo "&lt;td&gt;-&lt;/td&gt;";
                    $y++;
                }
            echo "
            &lt;/tr&gt;";
        }
    echo "
    &lt;/tbody&gt;
&lt;/table&gt;";
?&gt;
</code></pre>

<p><strong>UPDATE</strong></p>

<p>My new table called user_chore_relations looks like this:</p>

<pre><code>id | userid | choreid | count
-----------------------------
1  | 2      | 1       | 1
2  | 2      | 2       | 2
3  | 3      | 3       | 1
4  | 4      | 1       | 1
</code></pre>

<p>The new tbody while loop is now like this:</p>

<pre><code>while($row_chores=$result_chores-&gt;fetch_array()){
    echo "
    &lt;tr&gt;";
        echo "&lt;td&gt;".$row_chores['chore']." (".$row_chores['id'].")&lt;/td&gt;";
        $y = 1;
        $row_chores_id = $row_chores['id'];
        while($y &lt;= $x) {
            echo "&lt;td&gt;";
            $result_count=$dbcon-&gt;query("SELECT * FROM user_chore_relations WHERE choreid = ".$row_chores_id."");
            while($row_count=$result_count-&gt;fetch_array()){
                echo $row_count['userid']; //not needed but wanted to see what comes out, and it seems wrong. shouldn't it be same id all the way down the whole column? How is that done?
                echo $row_count['count'];
            }
            echo "
            &lt;/td&gt;";
            $y++;
        }
    echo "
    &lt;/tr&gt;";
}
</code></pre>

<p>Which makes HTML Table look like this:</p>

<pre><code>------------------------------------------------
| chores               | brian | frank | wendy |
------------------------------------------------
| Cleaned coffee table | 2141  | 2141  | 2141  |
------------------------------------------------
| Vacuumed rug         | 22    | 22    | 22    |
------------------------------------------------
| Did dishes           | 31    | 31    | 31    |
------------------------------------------------
</code></pre>

<p>What I am looking for is this:</p>

<pre><code>------------------------------------------------
| chores               | brian | frank | wendy |
------------------------------------------------
| Cleaned coffee table | 1     |       | 1     |
------------------------------------------------
| Vacuumed rug         | 2     |       |       |
------------------------------------------------
| Did dishes           |       | 1     |       |
------------------------------------------------
</code></pre>