Hello,
I'm creating a custom library, like this:
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class my_class {
protected $SDP;
public function __construct()
{
$this->SDP =& get_instance();
$this->SDP->load->database();
}
public function test4()
{
$query = $this->SDP->db->get('unit');
return $query->result_array();
}
and create this Model:
PHP Code:
<?php
class my_model extends CI_Model {
public function __construct()
{
$this->load->library('my_class');
}
public function test1()
{
$q = $this->my_class->test4();
var_dump($q);
}
Is my code follow the MVC and Codeigniter's standards for use Library and Model?
If it's wrong please help me to fix it.