I am trying to use the PHP mysql\_fetch\_assoc function and return my table records into an html table. I only have one record in the table right now, and when I run this PHP script it returns the values of the single record if I do...

```
print_r(mysql_fetch_assoc($QueryResult));

```

Which ends up returning...

```
Array ( [field_date] => 2013-10-03 [field_time] => 00:00:17 [name] => Dave [message] => This is a message. [switch] => Y )

```

But the following won't place the values into an html table row and I need help with this please.

```
$SQLstring = "SELECT * FROM `table` WHERE switch = 'Y'";

    // Run query and place in variable
    $QueryResult = mysql_query($SQLstring, $DBConnect);

    print_r(mysql_fetch_assoc($QueryResult));

    // Set the fetch command to the query recordset
    $Row = mysql_fetch_assoc($QueryResult);

    // Return records into a formatted table
    echo    "<table width='100%' border='1'>\n";
    echo    "<tr><th>Date</th><th>Time</th><th>Name</th>
        <th>Message</th><th>Switch</th></tr>\n";
    while ($Row = $result -> mysql_fetch_row($QueryResult)) {
        echo    "<tr><td>{$Row['field_date']}</td>";
        echo    "<td>{$Row['field_time']}</td>";
        echo    "<td>{$Row['name']}</td>";
        echo    "<td>{$Row['message']}</td>";
        echo    "<td>{$Row['switch']}</td></tr>";
    }
    echo "</table>\n";

```