View Single Post
Old 02-20-2013, 04:22 PM   PM User | #1
sonny
Regular Coder

 
sonny's Avatar
 
Join Date: Apr 2008
Location: United States
Posts: 567
Thanks: 88
Thanked 0 Times in 0 Posts
sonny can only hope to improve
foreach proper use of key values?

Hi, I'm creating a location map, this works for multi values from db.
PHP Code:
while($row mysql_fetch_array$result )) {
    
$lat=$row['lat'];
    
$lon=$row['lon'];
$pt getlocationcoords($lat$lon$scale_x$scale_y);
imagefilledrectangle($im,$pt["x"]-2,$pt["y"]-2,$pt["x"]+2,$pt["y"]+2,$dotcolor);

problem is I need to do this with 2 pairs of lat and lon with a foreach
not sure of the format how to do this or how to use the key/s properly

PHP Code:
$cord;
$cord["lat1"] = $lat1;
$cord["lon1"] = $lon1
$cord
["dotcolor1"] = $dotcolor1;

$cord["lat2"] = $lat2;
$cord["lon2"] = $lon2
$cord
["dotcolor2"] = $dotcolor2;

foreach( 
$cord as $key => $value){
//$pt = getlocationcoords($lat, $lon, $scale_x, $scale_y);
//imagefilledrectangle($im,$pt["x"]-2,$pt["y"]-2,$pt["x"]+2,$pt["y"]+2,$dotcolor);

Thanks
Sonny
sonny is offline   Reply With Quote