/
connect_error) {
return “
Database connection failed: ” . $conn->connect_error . “
“;
}
// Fetch latest 100 games (for performance; adjust as needed)
$query = “SELECT GameID, Name, BGG_ID, YearPublished, ScoreMethod, MFScore, Players, Time, thumbnail FROM Games ORDER BY GameID DESC LIMIT 100”;
$result = $conn->query($query);
if (!$result || $result->num_rows === 0) {
return “
No games found.
“;
}
// Build HTML table
$output = ‘
Game ID | Name | BGG ID | Year | Score Method | MF Score | Players | Time (min) | Thumbnail |
---|---|---|---|---|---|---|---|---|
‘ . htmlspecialchars($row[‘GameID’]) . ‘ | ‘ . htmlspecialchars($row[‘Name’]) . ‘ | ‘ . htmlspecialchars($row[‘BGG_ID’]) . ‘ | ‘ . htmlspecialchars($row[‘YearPublished’]) . ‘ | ‘ . htmlspecialchars($row[‘ScoreMethod’]) . ‘ | ‘ . htmlspecialchars($row[‘MFScore’]) . ‘ | ‘ . htmlspecialchars($row[‘Players’]) . ‘ | ‘ . htmlspecialchars($row[‘Time’]) . ‘ | ‘; if (!empty($row[‘thumbnail’])) { $output .= ‘ } else { $output .= ‘N/A’; } $output .= ‘ |
‘;
$conn->close();
return $output;
?>