title: PHP & Codeigniter - how to pass parameters to a model?
body: <p>I am using the following code to initialize a model from within my controller:</p>
  
  <pre><code>$this-&gt;load-&gt;model('model_name');
  </code></pre>
  
  <p>Is it possible to modify the above line somehow so that the model constructor recieves a parameter?  I want to use the following code in the model constructor:</p>
  
  <pre><code>function __construct($param_var) {
     parent::Model();
  
     $this-&gt;$param_var = $param_var; //I'm not even sure this works in PHP..but different issue
  }
  </code></pre>
  
  <p>This would be very helpful so that I can reuse my model classes. Thanks.</p>
  
  <p>UPDATE:
  (from one of the answers, my original question is solved..thanks!)
  Just to explain why I wanted to do this: the idea is to be able to reuse a model class.  So basically to give a simple example I would like to be able to pass an "order_by" variable to the model class so that I can reuse the logic in the model class (and dynamically change the order-by value in the sql) without having to create a separate class or a separate function.</p>
  
  <p>Is this poor design? If so could you please explain why you wouldn't do something like this and how you would do it instead?  </p>