Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Passing values from one function to another in a model?
#2

[eluser]pickupman[/eluser]
Codeigniter is object oriented so you when you want to call another function/method inside a controller/model/library you would use:
Code:
//Controller or Model or Library
function a(){
  //Do something here
}

function b(){
  //Get value from function a
  $this->a();
}

So you basically write $this->functionName() to reference a function/method in the same class/file. If you want to reference a function in another class's function/method, then you would use $this->anotherClass->functionName() (using CI's syntax). In regular PHP you would just use anotherClass->functionName().

A second part of your question/dilemma could also be fixed using a JOIN statement. You can join the two table based on a matching CatID.
Code:
$this->db->select("PageDetails.*, CatsList.*");
  $this->db->from("PageDetails");
  $this->db->join("CatsList","PageDetails.CatID=CatsList.CatID");
  $query = $this->db->get();


Messages In This Thread
[SOLVED] Passing values from one function to another in a model? - by El Forum - 04-19-2010, 10:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB