public function getFavoriteGamesiteForLoggedInUser($user) { $favoriteSite = ''; $databaseInfo = new DatabaseInfoModel(); $con = new mysqli($databaseInfo->getHost(), $databaseInfo->getUser(), $databaseInfo->getPassword(), $databaseInfo->getDatabaseName(), $databaseInfo->getPort(), $databaseInfo->getSocket()) or die('Could not connect to the database server' . mysqli_connect_error()); if ($stmt = $con->prepare($databaseInfo->getFavoriteGamesiteStoredProcedure() . '("' . $user . '")')) { $stmt->execute(); $stmt->bind_result($favorite); while ($stmt->fetch()) { $favoriteSite = $favorite; } $stmt->close(); } $con->close(); return $favoriteSite; }
private function connectToServerAndFetchRSS() { $databaseInfo = new DatabaseInfoModel(); $con = new mysqli($databaseInfo->getHost(), $databaseInfo->getUser(), $databaseInfo->getPassword(), $databaseInfo->getDatabaseName(), $databaseInfo->getPort(), $databaseInfo->getSocket()) or die('Could not connect to the database server' . mysqli_connect_error()); if ($stmt = $con->prepare($databaseInfo->getRSSFeedsStoredProcedure())) { $stmt->execute(); $stmt->bind_result($siteName, $rssLink); while ($stmt->fetch()) { // Save all DB-content to a "cache-array". $rss = new RssModel($siteName, $rssLink); $this->rssCache[] = $rss; } $stmt->close(); } $con->close(); }