Welcome Guest, Not a member yet? Register   Sign In
Loading 2 models in 1 controller function fails
#1

[eluser]Unknown[/eluser]
Hi everybody,

I am having some problems with CodeIgniter, I just can't explain. The situation is as followed, i have 1 controller and 2 models.(just for the sake of simplicity I have made 2 mockup models and 1 mockup 1 controller)

Code:
<?php
class Model1 extends CI_Model
{
private $str1;

public function __construct()
{
  parent::__construct();
}

public function doSomethingWithString()
{
  $this->string = "Hello World!";
  return $this->str1;
}

}

class Model2 extends CI_Model
{

private $str2;

public function __construct()
{
  parent::__construct();
}

public function doSomething()
{
  $this->string = "NOT AN Hello World!";
  return $this->str2;
}

}


class Somepage extends CI_Controller
{
public function __construct()
{
  parent::__construct();
}

public function page1()
{
  $this->load->model('Model1');
  var_dump($this->Model1->doSomethingWithString());
  
  $this->load->model('Model2');
  var_dump($this->Model2->doSomething());
}

public function page2()
{
  $this->load->model('Model1');
  var_dump($this->Model1->doSomethingWithString());
  
}

public function page3()
{
  $this->load->model('Model2');
  var_dump($this->Model2->doSomething());
}
}

?>

When my browser hits page1, everything just fails.. No output.. nothing nada zip. The log files dont output any error or anything that remotely looks like an warning.

page2 and 3 functions work, so I can safely assume the problem is not in my models..

What is going on here ? Where did I fuckup ?!


Messages In This Thread
Loading 2 models in 1 controller function fails - by El Forum - 05-02-2014, 02:34 AM
Loading 2 models in 1 controller function fails - by El Forum - 05-02-2014, 02:55 AM
Loading 2 models in 1 controller function fails - by El Forum - 05-02-2014, 03:10 AM
Loading 2 models in 1 controller function fails - by El Forum - 05-02-2014, 06:06 AM
Loading 2 models in 1 controller function fails - by El Forum - 05-02-2014, 07:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB