PHP build array of unique address from database rows
<p>How could I build a unique array check each of the address fields.</p>

<p>E.g at the moment I get everything:</p>

<pre><code>$stmnt = "SELECT `location_id`, `location_address1`, `location_address2`,
            `location_town`, `location_region`, `location_postcode`
          FROM locations WHERE user_id = '{$id}'";
$results = $db-&gt;fetchAll($stmnt);

    if(!empty($results ))  {
        foreach($results as $row) {
            if($unique){
                $value = $row['location_id'];
                $label = implode(", ", array(
                    'address1'      =&gt; $row['location_address1'],
                    'address2'      =&gt; $row['location_address2'],
                    'town'          =&gt; $row['location_town'],
                    'region'        =&gt; $row['location_region'],
                    'postcode'      =&gt; $row['location_postcode']
                ));
            }
</code></pre>

<p>I was thinking that where <code>if($unique){</code> is you would check this address1, address2, etc exist in the temp array by searching this some how?</p>
