function build_points() { $extra_fields = ""; if ($this->P['label_field'] and $this->P['label_field'] != 'City') { $extra_fields = ", " . $this->P['label_field']; } if ($this->P['hover_field']) { $extra_fields .= ", " . $this->P['hover_field']; } if ($this->P['geo_field']) { $extra_fields .= ", " . $this->P['geo_field']; } if ($this->P['table'] == 'calendar') { $sql = "select id, lcity as City, lstate as State, lzip as Zip" . $extra_fields . " from calendar where publish=1 " . $this->P['extra_sql']; // and typeid =$type } else { $sql = "select id, City, State, Street, Zip" . $extra_fields . " from " . $this->P['table'] . " where publish=1 " . $this->P['extra_sql']; } trigger_error("sql:{$sql}"); $R = $this->dbcon->CacheExecute($sql) or trigger_error("Error getting city data in build_points function " . $sql . $this->dbcon->ErrorMsg()); $x = 0; while (!$R->EOF) { if ($this->P['geo_field']) { $location = $R->Fields($this->P['geo_field']); trigger_error("location: {$location}"); list($lat, $lng) = explode(",", $location); } else { $geo = new Geo($this->dbcon); $geo->City = $R->Fields("City"); $geo->State = $R->Fields("State"); #$geo->State = "CA"; $geo->city_fulltext = true; $geo->city_soundex = true; $geo->city_lookup(); $lat = $geo->lat; $lng = $geo->long; $location = $geo->lat . "," . $geo->long; } if ($location != ',' and isset($location)) { $this->points[$x]['name'] = wordwrap(htmlspecialchars($R->Fields($this->P['label_field'])), 30, htmlspecialchars('<br>')); $this->points[$x]['loc'] = $location; $this->points[$x]['lat'] = $lat; $this->points[$x]['long'] = $lng; $this->points[$x]['Street'] = htmlspecialchars($R->Fields("Street")); $this->points[$x]['City'] = htmlspecialchars($R->Fields("City")); $this->points[$x]['State'] = $R->Fields("State"); $this->points[$x]['Zip'] = $R->Fields("Zip"); $this->points[$x]['id'] = $R->Fields("id"); $this->points[$x]['hover'] = htmlspecialchars($R->Fields($this->P['hover_field'])); $x++; } $R->MoveNext(); } }