php - How to separate two columns with the same name while using JOIN LEFT? -


mysql table looks this:

markers id, tid,        lat,    lng 1   1           42.000  2.500 2   1           41.000  2.400 3   2           40.000  2.300  markers_types id, name,   image 1   type1   type1.png 2   type2   type2.png 

while using codeigniter's active records:

function get_coordinates(){      $this->db->select('*');     $this->db->from('markers');     $this->db->join('markers_types', 'markers.tid = markers_types.id');     $this->db->where('state', 1);     $query = $this->db->get();      if( $query->result() < 1 ) return false;      $results = $query->result();     return $results;  } 

it concatenate (or merge) 2 columns named id one, 2 different tables. how prevent that? , possible prevent merging these columns without renaming them ?

just modify $this->db->select('*'); statement list out individual table.field names want capture in response.

$this->db->select('markers.type_id, markers.lat, markers.lng, markers_types.id, markers_types.name, markers_types.image'); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -