function getAllGroups($value) { $con = QC_Database::getQuartzcoreDatabase(); $groups = array(); if (isset($value)) { $groups_result = mysqli_query($con, 'SELECT * FROM Groups'); if ($value = "id") { while ($group = mysqli_fetch_array($groups_result, true)) { array_push($groups, $group['id']); } } return $groups; } return false; }
function getNewestPlayers($limit, $value) { $con = QC_Database::getQuartzcoreDatabase(); $newest = array(); if (isset($limit)) { if ($newest_results = mysqli_query($con, 'SELECT * FROM PlayerData ORDER BY id DESC LIMIT ' . $limit . ';')) { while ($player = mysqli_fetch_array($newest_results, true)) { if (isset($value)) { switch ($value) { case 'name': array_push($newest, $player['DisplayName']); } } else { array_push($newest, $player['DisplayName']); } } } else { $newest['error'] = 'No newest players'; } } else { if ($newest_results = mysqli_query($con, 'SELECT * FROM PlayerData ORDER BY id DESC LIMIT 20;')) { while ($player = mysqli_fetch_array($newest_results, true)) { if (isset($value)) { switch ($value) { case 'name': array_push($newest, $player['DisplayName']); } } else { array_push($newest, $player['DisplayName']); } } } else { $newest['error'] = 'No newest players'; } } return $newest; }