Independent database

#1
[eluser]Diego Pessoa[/eluser]
Hi, I'm trying to use the CI follow the OOP paradigm, but, a thing is incommode me, the database is attached in the CI Model class, specifically, to use the database:

Code:
$this->db->get('table')
or $this->db->select, $this->db->insert, etc.

Follow the OOP rules in a class I need of static methods, example:

Code:
class User extends Model{
public $id;
public $name;
public $login;
public $pass;

public static function getUserById($id) {
$this->db->select('select from users where id = '$id'); //THE PROBLEM
}

}

How I can to use the database in static methods with CI?

Thankx,
Diego Pessoa


Messages In This Thread
Independent database - by El Forum - 04-03-2008, 04:16 PM
Independent database - by El Forum - 04-03-2008, 04:53 PM
Independent database - by El Forum - 04-03-2008, 05:09 PM
Independent database - by El Forum - 04-03-2008, 05:27 PM
Independent database - by El Forum - 04-03-2008, 05:34 PM
Independent database - by El Forum - 04-03-2008, 05:56 PM
Independent database - by El Forum - 04-03-2008, 06:00 PM
Independent database - by El Forum - 04-03-2008, 06:41 PM
Independent database - by El Forum - 04-03-2008, 07:41 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.