[eluser]loonychune[/eluser]
I was just working through a form, escaping the values in the controller(!) because I wanted to reuse the variables.
So, I'm thinking of escaping the values something like this:
Code:
class Something extends Model {
public $user;
public $pass;
function escape_values($user, $pass) {
$this->user = $this->db->escape($user);
$this->pass = $this->db->escape($pass);
}
function use_values() {
//now i can always refer to the variables
$query = $this->db->query("DELETE FROM table WHERE pass = {$this->pass}");
}
}
This seems an efficient way to do things if i had say, 5 or 6 functions reusing the $user and $pass values... I don't want to have to escape the values in EVERY method.
What do you think???
I'm also curious about how to go FURTHER... i.e. MY_Controller pops up a lot in the forums and seems to be a way of implementing reusable functionality.
Appreciate your input...