Skip to content

Instantly share code, notes, and snippets.

@dongnv92
Last active April 7, 2023 04:35
Show Gist options
  • Select an option

  • Save dongnv92/e1f791ecba7f28046369d439f276baf7 to your computer and use it in GitHub Desktop.

Select an option

Save dongnv92/e1f791ecba7f28046369d439f276baf7 to your computer and use it in GitHub Desktop.
$connect = mysqli_connect(GML_MYSQL_HOST, GML_MYSQL_USER, GML_MYSQL_PASSWORD, GML_MYSQL_DB);
mysqli_set_charset($connect, "utf8");
function StatusGame($connect){
$table = '';
$games = mysqli_query($connect, 'SELECT * FROM game');
$games = mysqli_fetch_all($games, MYSQLI_ASSOC);
foreach ($games AS $game){
$skins = mysqli_query($connect, 'SELECT * FROM skin WHERE skin_game = "'. $game['id'] .'"');
$skins = mysqli_fetch_all($skins, MYSQLI_ASSOC);
$table .= '<table style="width: 100%; border-collapse: collapse;border: 1px solid;">';
$table .= '<thead><tr><td colspan="2" style="text-align: center; color: white; font-weight: bold;">'. $game['game_name'] .'</td></tr></thead>';
$table .= '<tbdoy>';
foreach ($skins AS $skin){
if($skin['skin_status'] == 0){
$skin_display = 'OFF';
$color_status = '#E74646';
}else{
$skin_display = 'ON';
$color_status = '#03C988';
}
$table .= '<tr>';
$table .= '<td style="width: 80%; text-align: right; color: '. $color_status .'; font-weight: bold;">'. $skin['skin_name'] .'</td>';
$table .= '<td style="text-align: right; color: '. $color_status .'; font-weight: bold;">'. $skin_display .'</td>';
$table .= '</tr>';
}
$table .= '</tbdoy>';
$table .= '</table>';
}
return $table;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment