PHP + MySQL,按类别输出结果

I'm trying to hack the WP plugin 'Contact Form 7' (with the DB extension) to output the results to my liking after the user has submitted the form. I understand why the plugin has to arrange the DB the way it does, but I'm having trouble separating the entries. Usually I would have an index to work with but here I do not.

Here is what my table looks like.

+-----------------+-----------+-----------------+---------------------+-------------+------+
|   submit_time   | form_name |   field_name    |     field_value     | field_order | file |
+-----------------+-----------+-----------------+---------------------+-------------+------+
| 1360190186.3500 | RSVP 2    | text-796        | Mindi               |           0 | NULL |
| 1360190186.3500 | RSVP 2    | text-664        | Smith               |           1 | NULL |
| 1360190186.3500 | RSVP 2    | text-635        | New York            |           2 | NULL |
| 1360190186.3500 | RSVP 2    | menu-359        | A friend of Sarah's |           3 | NULL |
| 1360190186.3500 | RSVP 2    | textarea-518    |                     |           4 | NULL |
| 1360190186.3500 | RSVP 2    | file-29         |                     |           5 | NULL |
| 1360190186.3500 | RSVP 2    | textarea-652    |                     |           6 | NULL |
| 1360190186.3500 | RSVP 2    | Submitted Login | admin               |        9999 | NULL |
| 1360190186.3500 | RSVP 2    | Submitted From  | ::1                 |       10000 | NULL |
| 1360191326.9700 | RSVP 2    | text-796        | Joe                 |           0 | NULL |
| 1360191326.9700 | RSVP 2    | text-664        | Blow                |           1 | NULL |
| 1360191326.9700 | RSVP 2    | text-635        | Somewhere           |           2 | NULL |
| 1360191326.9700 | RSVP 2    | menu-359        | A friend of Bob's   |           3 | NULL |
| 1360191326.9700 | RSVP 2    | textarea-518    |                     |           4 | NULL |
| 1360191326.9700 | RSVP 2    | file-29         |                     |           5 | NULL |
| 1360191326.9700 | RSVP 2    | textarea-652    |                     |           6 | NULL |
| 1360191326.9700 | RSVP 2    | Submitted Login | admin               |        9999 | NULL |
| 1360191326.9700 | RSVP 2    | Submitted From  | ::1                 |       10000 | NULL |
| 1360361333.8800 | RSVP 2    | text-796        | Once                |           0 | NULL |
| 1360361333.8800 | RSVP 2    | text-664        | Again               |           1 | NULL |
| 1360361333.8800 | RSVP 2    | text-635        | Somewhere           |           2 | NULL |
| 1360361333.8800 | RSVP 2    | menu-359        | A friend of Bob's   |           3 | NULL |
| 1360361333.8800 | RSVP 2    | textarea-518    |                     |           4 | NULL |
| 1360361333.8800 | RSVP 2    | file-29         |                     |           5 | NULL |
| 1360361333.8800 | RSVP 2    | textarea-652    |                     |           6 | NULL |
| 1360361333.8800 | RSVP 2    | Submitted Login | admin               |        9999 | NULL |
| 1360361333.8800 | RSVP 2    | Submitted From  | ::1                 |       10000 | NULL |
+-----------------+-----------+-----------------+---------------------+-------------+------+

My PHP is a little rusty so I'm wondering what's the most efficient way to iterate through the only unique field ('submit_time') to isolate the entries?

I was able to solve it by creating an array with the unique submit_time fields and then looping through each of those with that as a variable in the query. For those of you interested here is the result.

$group = mysql_query('SELECT * FROM wp_cf7dbplugin_submits GROUP BY submit_time');

while ($st = mysql_fetch_row($group)) {
    $myarray[] = $st[0];
}

foreach ($myarray as $value) {
    $query = "SELECT field_value FROM wp_cf7dbplugin_submits WHERE submit_time = ".$value;
    $entry = mysql_query($query);

    while ($row = mysql_fetch_row($entry)) {
        if (!empty($row[0])) {
            echo $row[0];
            echo '<br>';
        }
    }

    echo '<br><br>';
}

I guess you're using $result = mysql_query(); or something like that to get these values. Then you do the following:

while ($row = mysql_fetch_assoc($result /*or your result varname*/ )) {
    //do the things you want to do
}

$row now is an associative array with the fields the mySql table contains. In your case you could use this for printing the field_name-column (just an example):

//inside the while-loop:
echo $row["field_name"]."<br/>";

This is how you can read every entry of the table. each repeating of the loop increments the row number you're reading out. If you're at the end or there is an error, mysql_fetch_assoc() returns false and the loop is quit.