Search code examples
phpmysqlpyrocms

Table prefix in pyrocms


I am working on a custom multiple delete in pyrocms module,how to use delete in model my code:

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

        }

but $this->_table is returning accounts instead of username_accounts,how to check username table prefix in from clause in pyrocms


Solution

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

    or

    protected $_table = 'username_accounts';
    

    or dyamically

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