/** * @return string */ public function getId() { if (!isset($this->attributes['id'])) { vdd($this->attributes); } return $this->attributes['id']; }
public static function LoadFromName($_userName) { $result = false; if ($stmt = Database::GetLink()->prepare('SELECT `user_id`, `fname`, `lname`, `email`, `telno` FROM `User` WHERE user_name = ?')) { $stmt->bindParam(1, $_userName, PDO::PARAM_STR, 255); $stmt->execute(); $rows = $stmt->fetchAll(); if (sizeof($rows) == 1) { $row = $rows[0]; if (sizeof($row) == 10) { $user = new User(); $user->userId = $id; $user->firstName = $row[0]; $user->lastName = $row[1]; $user->email = $row[2]; $user->telNo = $row[3]; $user->userName = $row[4]; $result = $GLOBALS['USERS'][$id] = $user; vdd($GLOBALS['USERS']); } } } return $result; }