CodeIgniter static class question

Posted by Josh K on Stack Overflow See other posts from Stack Overflow or by Josh K
Published on 2010-06-17T20:58:49Z Indexed on 2010/06/17 21:03 UTC
Read the original article Hit count: 176

Filed under:
|
|
|
|

If I would like to have several static methods in my models so I can say User::get_registered_users() and have it do something like

public static function get_registered_users()
{
    $sql = "SELECT * FROM `users` WHERE `is_registered` = 0";
    $this->db->query($sql);
    // etc...
}

Is it possible to access the $this->db object or create a new one for a static method?

© Stack Overflow or respective owner

Related posts about php

Related posts about query