Yea, Ill admit the subject to this post is not perfect. However I have no idea how to word it currently.
What I am trying to do is avoid the $this->db->query($sql); type of statement. I would prefer to use this in an active record method, but I am unsure how to do that at the moment.
my Query is set to look something to the concept of
select loc.distance,
loc.user,
loc.lat,
loc.lon,
baseinfo.firstname,
baseinfo.lastname,
(((acos(sin((".$this->db->escape($lat)."*pi()/180)) * sin((`latitude`*pi()/180))+cos((".$this->db->escape($lat)."*pi()/180)) * cos((`latitude`*pi()/180)) * cos(((".$this->db->escape($lon)." - `longitude`)*pi()/180))))*180/pi())*60*1.1515) AS `distance`
FROM memb_geo_locations loc
Then it gets a little more extensive as I build out the rest with potential LEFT JOINS, JOINS, etc..
But this guy..
(((acos(sin((".$this->db->escape($lat)."*pi()/180)) * sin((`latitude`*pi()/180))+cos((".$this->db->escape($lat)."*pi()/180)) * cos((`latitude`*pi()/180)) * cos(((".$this->db->escape($lon)." - `longitude`)*pi()/180))))*180/pi())*60*1.1515) AS `distance`
I am not sure how to tie that into the active record method, and I am seeking some help. Any ideas?