Welcome Guest, Not a member yet? Register   Sign In
Returning Data From a Class (solved: pass $data to the method)
#2

[eluser]tonanbarbarian[/eluser]
firstly in your view the variable would be $someStaticData not $x
secondly because you are assigning the result of the method call to $data its value is overwritten
you could pass $data to the method and either add to it and return it, or pass it by reference

Code:
function detail($id, $data) {
  $detail[name] = $row->name;
  $detail[body] = $row->body;
  return detail;
} // detail()

Code:
$data['someStaticData'] = 'x';
$data = $this-Myclass->detail($id, $data);

OR

Code:
function detail($id, &$data) {
  $detail[name] = $row->name;
  $detail[body] = $row->body;
} // detail()

Code:
$data['someStaticData'] = 'x';
$this-Myclass->detail($id, $data);


Messages In This Thread
Returning Data From a Class (solved: pass $data to the method) - by El Forum - 01-21-2008, 04:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB