title: Calling model function from another model CodeIgniter?
body: <p>I have some classes, that I want to load as a model, but problem is I want to separate them in several models, now I have one file with classes that looks like this:</p>
  
  <pre><code>class email {
          function add($email, $name, $quiet=NULL, $actiovation=NULL) {
          global $secretstring;
          global $mail;
          global $path;
          global $activating;
  
          if (strlen($email) &lt; 1) {
              if (!isset($quiet)) {
                  msg::getInstance()-&gt;addSuccess("Please enter your email address.");
              }
              $error = 1;
          }
          if (strlen($name) &lt; 1) {
              if (!isset($quiet)) {
                  msg::getInstance()-&gt;addSuccess("Please enter your name.");
              }
              $error = 1;
          }
                      $addData = mysql_fetch_array(sql::getInstance()-&gt;query("SELECT id FROM emails WHERE email='".sql::getInstance()-&gt;sec($stamp)."'")); // getting id of this email
  
  }
  
  class msg {
      static private $instance = NULL;
      function addSuccess($success) {
          $this-&gt;success .= $success."\\n ";
      }
  }
  
  class sql {
      static private $instance = NULL;
  
      function query($query) {
          return mysql_query($query);
      }   
  
      function sec($string) {
          return mysql_real_escape_string(htmlspecialchars($string));
  }
  </code></pre>
  
  <p>With instance I can easily call function from another class? But problem is when I want to call function from another model, in one model, I don't know how to make that in CI? Any help I have made a simple example to show how I made classes.</p>