codeigniter differentiate field names in JOINed tables
- by Patrick
Hi, I need to retrieve data from two tables. the first is a list of events, the second is a list of venues. 
I have a fields with the same name in both tables: events.venue (which is an ID) and venues.venue is the name of the place, say "blues bar".
The tables can be joined on events.venue = venues.id.
Snippet of my model:
$this->db->select('events.*, venues.*');
        $this->db->join('venues', 'events.venue = venues.id');
        if ($date != 'all')
        {
            $this->db->where('date', $date);
        }
        if ($keyword)
        {
            $this->db->like('description', $keyword);
            $this->db->or_like('band', $keyword);
            $this->db->or_like('venue', $keyword);
            $this->db->or_like('genre', $keyword);
        }
        $Q = $this->db->get('events');
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        return $data;
Snippet of the View:
foreach ($events as $row) {
            echo    "<p>{$row->band} ({$row->genre})<br />";
            echo    "Playing at: {$row->venue}<br /></p>"; // echoes "blues bar"
//more here...
}
2 Questions: 
1) Why does $row-venue echo venues.venue, instead of events.venue?
B) how can I differentiate them? eg. What if I want to echo both events.venue and venues.venue? I can probably do something like "SELECT venues.venue as name_of_the_venue", but how can I do this when I've already selected *?