错误号码:1066活动记录codeigniter

时间:2014-07-23 11:42:41

标签: codeigniter

我正在尝试与codeigniter进行分页,并且我已收到此消息:

  

错误号码:1066   不是唯一的表/别名:' albuns'

型号:

function get_titles($per_pg, $offset)<br />
{   
$this->db->select('albuns.*', 'players.name', 'players.id AS artistid', FALSE);<br />
$this->db->from('albuns');<br />
$this->db->join('players', 'albuns.player_id = players.id', 'inner');<br />
$this->db->order_by('albuns.ano', 'asc');<br />
$query = $this->db->get('albuns', $per_pg, $offset);<br />
return $query->result();<br />  
}

$per_pg = 20 and $config['per_page'] = $per_pg, on Controller;<br/>
$offset = $this->uri->segment(3); on Controller<br /><br />

1 个答案:

答案 0 :(得分:0)

你选择了表&#34; albuns&#34;两次:

function get_titles($per_pg, $offset)
{   
    $this->db->select('albuns.*', 'players.name', 'players.id AS artistid', FALSE);
    //$this->db->from('albuns');
    $this->db->join('players', 'albuns.player_id = players.id', 'inner');
    $this->db->order_by('albuns.ano', 'asc');
    $query = $this->db->get('albuns', $per_pg, $offset);
    return $query->result();
}

希望有所帮助