[eluser]JamesTaylor[/eluser]
Thanks Phil, got it working with ActiveRecords using the following... so i now have working in both fashions which is comforting and confidence building!
Code:
$this->db->select('ClubID, Name, Lat, Lng, Address1, Address2, Address3, County, PostCode, TelArea, TelNo, Web, Email, Review')
->select('"( 3959 * acos( cos( radians($Lat) ) * cos( radians( Lat ) ) * cos( radians( Lng ) - radians($Lng) ) + sin( radians($Lat) ) * sin( radians( Lat ) ) ) )" AS distance');
$this->db->having('distance < ' .$Dist);
$this->db->order_by('distance');
$this->db->limit($LimitValue, $OffsetValue);
$query = $this->db->get('golfcourses');
a couple of things i notice with your sample...
you don't declare '$this->db' again after the inital '$this->db->select' statement i didn't realise it could be done this way, is it common / good / better practice to implement your style than the repetition that i use?
I note that in the code i have supplied which works as it is shown, if i have
Code:
$this->db->select(........
$this->db->select(........
$this->db->having(........
it throws up an error when it tries to execute, but when it is
Code:
$this->db->select(........
->select(........
$this->db->having(........
It works??
The other thing i don't quite follow is the 'FALSE' you have included at the end of the 2nd ->select() line. What is its purpose?
Thanks again for the reply!