public function editUser(User $user) { $db = Database::getInstance('app'); $result = $db->prepare("UPDATE users SET password = ?, username = ? WHERE id = ?"); $result->execute([$user->getPass(), $user->getUsername(), $user->getId()]); return $result->rowCount() > 0; }
private static function update(User $model) { $db = Database::getInstance('app'); $query = "UPDATE users SET username= :username, password= :password, gold= :gold, food= :food, grass= :grass WHERE id = :id"; $result = $db->prepare($query); $result->execute([':id' => $model->getId(), ':username' => $model->getUsername(), ':password' => $model->getPassword(), ':gold' => $model->getGold(), ':food' => $model->getFood(), ':grass' => $model->getGrass()]); }