Creating A Store Locator With Php, Mysql & Google Maps

hi YII …i have a MySQL database that contains latitude and longitude, how do I call these coordinates to be displayed in the map ?

CREATE TABLE places (

id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,

name VARCHAR( 60 ) NOT NULL ,

address VARCHAR( 80 ) NOT NULL ,

lat FLOAT( 10, 6 ) NOT NULL ,

lng FLOAT( 10, 6 ) NOT NULL

)

this is my DB table

i need show this using MAp

how do this

now i refer this link

https://developers.google.com/maps/articles/phpsqlsearch_v3

have any extention like this…

:D

I like the egmap extension for mapping in Yii: http://www.yiiframew…xtension/egmap/

Assuming your database table "places" has a model associated with it you could get the latitude and longitude like this:




$place = Place::model()->find('id=:placeId', array(':placeId'=>$placeId));

echo "Place: " . $place->name . "<br>";

echo "Latitude: " . $place->lat . "<br>";

echo "Longitude: " . $place->lng . "<hr>;



With that working you can install the egmap extension and follow the instructions from the link above to get started on your map.

thank mr ben i try this code

$Criteria = new CDbCriteria();

				&#036;Criteria -&gt; select = sprintf(&quot;*,( 3959 * acos( cos( radians(%s) ) * cos( radians( latitute ) ) * cos( radians( longtute ) - radians(%s) ) + sin( radians(%s) ) * sin( radians( latitute ) ) ) ) AS distance&quot;,&#036;_GET['lat'],&#036;_GET['lng'],&#036;_GET['lat']);


				&#036;Criteria -&gt; order = 'distance';								


				&#036;Criteria -&gt; having =sprintf(&quot;distance &lt;=%s&quot;,&#036;_GET['range']);							


				&#036;models = Places::model()-&gt;findAll(&#036;Criteria);

it working thank for your kind help