You are here: Re: ARRAY - straightforward question? « PHP Programming Language « IT news, forums, messages
Re: ARRAY - straightforward question?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация