Welcome Guest, Not a member yet? Register   Sign In
Is it possible to UNLOAD a model?
#14

[eluser]autefrum[/eluser]
SOLVED!

Persistence pays off, and with the help of the others in this forum, here is how I fixed it.

I used variable references as suggested by Pygon, but not for the entire "$this->model", just for the model name:

Code:
for ($i = 1;$i<$number_of_mdels;$i++) {
$model_name = 'model_'.$i;
echo "model_name:$model_name<br>";
$this->load->model($model_name);
echo $this->$model_name->return_a_string()."<br>";
}

Note the
$this->$model_name (where $model_name=="model_1")
rather than
$this->model_1

I guess this is more of a php language query/solution than a codeIgniter query/solution but it had me stumped for a few weeks...


Messages In This Thread
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 10:38 AM
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 11:51 AM
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 12:44 PM
Is it possible to UNLOAD a model? - by El Forum - 11-17-2007, 03:59 AM
Is it possible to UNLOAD a model? - by El Forum - 04-01-2009, 10:01 AM
Is it possible to UNLOAD a model? - by El Forum - 10-17-2009, 11:02 PM
Is it possible to UNLOAD a model? - by El Forum - 10-18-2009, 07:17 AM
Is it possible to UNLOAD a model? - by El Forum - 02-17-2012, 06:42 PM
Is it possible to UNLOAD a model? - by El Forum - 02-18-2012, 02:53 AM
Is it possible to UNLOAD a model? - by El Forum - 02-20-2012, 12:12 PM
Is it possible to UNLOAD a model? - by El Forum - 02-20-2012, 01:00 PM
Is it possible to UNLOAD a model? - by El Forum - 07-12-2013, 07:08 PM
Is it possible to UNLOAD a model? - by El Forum - 07-31-2013, 09:21 PM
Is it possible to UNLOAD a model? - by El Forum - 07-31-2013, 09:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB