Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/26/2020 in all areas

  1. $res = $db->query("SELECT name , timestampdiff(MONTH, doj, curdate()) as sen , timestampdiff(YEAR, dob, curdate()) as age FROM MEMBER ORDER BY sen DESC, age DESC "); $members = $res->fetchAll(); $titles = ['Leader', 'Assistant', 'Member 1', 'Member 2', 'Member 3', 'Member 4', 'Member 5', 'Member 6', 'Member 7', 'Member 8']; I originally set out on the round-robin route to allocate the members to teams ... $teams = []; $t = 0; foreach ($members as $r) { $teams[$t%6][] = $r; $t++; } ... but the problem with this method is it's bias. Team 1 gets the most experienced Leader and Team 6 gets the least experienced. On the next cycle, Team 1 gets the most experienced Assistant and Team 6 again gets the least, and so on for all levels. Therefore I'd recommend an approach which gets the players for each level then shakes the bags before allocating to teams $ranks = array_chunk($members, 6); // get a chunk of 6 members for each rank $tdata = ''; foreach ($ranks as $r => $rmembers) { shuffle($rmembers); // shake the bag - random allocation to teams $tdata .= "<tr><td class='rank'>{$titles[$r]}</td>"; foreach ($rmembers as $m) { $tdata .= "<td>{$m['name']} <span class='years'>({$m['sen']}/{$m['age']})</span></td>"; } $tdata .= "</tr>\n"; }
    1 point
  2. Here's a really good article about this issue (and other related ones you might not have though about either: https://www.danielmorell.com/guides/htaccess-seo/redirects/https-www-and-trailing-slash For example another related problem: https://www.mysite.com/foo/bar and https://www.mysite.com/foo/bar/ Will be seen as 2 different urls, so you want to effectively remove the trailing slash when you are routing a non-directory.
    1 point
  3. FFS dil_bert. This is one of the most requested mod_rewrite things in existence. Do you know what I'm going to say next? I honestly don't know if you do. Google it.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.