pyrocms中的表前缀

时间:2013-04-19 06:42:14

标签: php mysql pyrocms

我正在pyrocms模块中进行自定义多重删除,如何在模型中使用delete 我的代码:

 protected $_table = 'accounts';
    public function mulDelete($muldelete) 
        {   
            $sql = 'delete from ' . $this->_table . ' where id IN('.$muldelete. ')';
            $query = $this->db->query($sql);

        }
  

但是$ this-> _table是返回帐户而不是   username_accounts,如何检查from子句中的用户名表前缀   pyrocms

1 个答案:

答案 0 :(得分:0)

$sql = 'delete from ' .'username_'. $this->_table . ' where id IN('.$muldelete. ')';

protected $_table = 'username_accounts';

或动态

    $CI =& get_instance();
    $CI->load->database();
    echo $CI->db->dbprefix;