Beginner level processing and echoing arrays

I am trying to extract data from a mysql database and list out two items from each record. Each record contains a name and an address among other fields. The trouble I’m having is when it comes to processing each array and then echoing each pair(name, address) for use in something simple like a list or a table. I think the answer is probably to process each pair into an array, then when it comes to echoing the results, process the array seperately.

Am I writing the sql query correctly?
What’s the proper way to write the php for fetching results and echoing it out in my html doc?

<?php
// 1. write the SQL query
$sql = “SELECT Name, Address FROM shops”;

// 2. Query the database
$result = mysql_query($sql, $connection);

[COLOR="Red"]// 3. Fetch the results
while($row = mysql_fetch_assoc($result))
{
    $names[] = $row['Name'];          
             $addr[] = $row['Address'];                              		

}[/COLOR]
include "includes/home.html.php";

?>

relevant code from the html include file below

ol>
<?php foreach ($names as $name); ?>
//do i need to create another similar statement here for $addr?
<li>
<?php echo htmlspecialchars($name, ENT_QUOTES, ‘UTF-8’); ?>

  &lt;?php endforeach; ?&gt;&lt;/li&gt;

</ol>

Everything was fine except for your array, when retrieving data from the database its common to store the data in a single array then define the relevant array key for that database value. You also had an error with your foreach statement as you wrote ; instead of : at the end of the statement, see the updated code below would should work fine.

<?php

// 1. write the SQL query
$sql = "SELECT Name, Address FROM shops";

// 2. Query the database
$result = mysql_query($sql, $connection);

// 3. Fetch the results
$results = array();
while($row = mysql_fetch_assoc($result))
{
    $results[] = array('name' => $row['Name'], 'address' => $row['Address']);
}

include "includes/home.html.php";
?>
<ol>
    <?php foreach($results as $result): ?>
    <li><?php echo htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8'); ?></li>
    <?php endforeach; ?>
</ol>

A easier way to fetch the results is:

$results = array();
while($row = mysql_fetch_assoc($result)) {
    $results[] = $row;
    }

That’s the way that I prefer though the end result is the same as in SgtLegend’s post above.