function getId() { // query database // set id return true if found // else return false $db = new MyDB(); $this->id = $db->getUserId($this->name, $this->pwd); $db->close(); return $this->id; }