public static function getClientByID($ID) { $query = "SELECT * FROM " . Database::addPrefix('clients') . " WHERE ClientID = '" . Database::makeStringSafe($ID) . "' LIMIT 1"; $result = Database::doQuery($query); if (mysql_num_rows($result) == 1) { $client = mysql_fetch_assoc($result); return new Client($client['ClientID'], LoginDao::getLoginById($client['LoginID']), $client['Name'], $client['Email'], $client['Phone'], $client['Address']); } else { return null; } }
public function __construct($clientId, $login, $name, $email, $phone, $address) { $this->clientId = $clientId; if ($login instanceof Login) { $this->login = $login; } else { $this->login = LoginDao::getLoginById($login); } $this->name = $name; $this->email = $email; $this->phone = $phone; $this->address = $address; }