选择(最大)+1然后插入Codeigniter

时间:2015-06-01 15:08:58

标签: mysql codeigniter

如何通过j_id插入队列行的所选最大值然后+1?

控制器:

$id = array('j_jumlah' => ($this->input->post('jid'));
$this->mmeeting->add_q($id);

模仿模型:

function add_q($id){
        $query = $this->db->query('INSERT q_numb (Select_max(q_numb)+1)
                           SELECT j_id
                           FROM meeting
                           WHERE j_id = $id');
        }

0 个答案:

没有答案