Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User
- {
- public $db;
- public $id;
- public $username;
- public $password;
- public function __construct($db, $id = 0)
- {
- $this->db = $db;
- $this->id = $id;
- }
- public function showOne()
- {
- if($this->$id !== 0)
- {
- $query = mysql_query("SELECT `username`, `password` FROM `user` WHERE `id` = $this->id");
- $result = mysql_fetch_assoc($query);
- if($result)
- {
- $this->username = $result['username'];
- $this->password = $result['password'];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement