User class - 'load' data
- by John
<?php
class User {
private $id;
private $username;
public function __construct($id = null) {
$this->id = $id;
if (!is_null($this->id)) {
$this->load();
}
}
public function load() {
}
}
?>
In the 'load' method I am going to load all the information from the current user (id) But I wonder how is the best way to load all info. I could grab all data and then just assign all private variables, but I assume there must be another "cheaper" way to get all the data so I can use as such
$this-variable;
And not have to ASSIGN every single data row, I select in the load method. How?