|
Posted by elyob on 11/19/68 11:46
"Jimbus" <mrbiggles909@yahoo.com> wrote in message
news:Y675g.5024$XV5.4781@fed1read10...
> Use an associative array with the coordinates as the key. That way any biz
> that has the same coords will appear under that key in the array.
>
> while($row = mysql_fetch_assoc($result)) {
> $data[ $row['coordinates'] ][] = $row['bizname'];
> }
>
> Note, 'coordinates' and 'bizname' are the db cols, your db col name will
> probably differ from my example.
> Also note second set of empty square braces. These create a new var under
> that key, otherwise you'd just be overwriting the last bizname you saved.
Thanks, my coordinates are currently split into "latitude" and "longitude"
cols, although I will also be soon using the geospatial functionality in
mysql. (Geomotry Point etc).
So, should I be looking to do something like this ... ?
while($row = mysql_fetch_assoc($result)) {
$data[ $row['longitude'].$row['latitude'] ][] = $row['bizname'];
}
Thanks
Navigation:
[Reply to this message]
|