The first function listed below is creating all the [O] next to players' names. Hover over them, and it will show the list of colleges which have offered them scholarships. The function also determining which players are Committed to a college, which should be printed right below the player's name -- if applicable, and until this morning, it was working just fine.
The gray background print, created by the 'committed' function below, each one of them is one cell lower than it should be.
- Indiana State should be in the same cell as Lincoln Hale
- Indiana (Baseball) should be in the same cell as Colson Montgomery
- Butler should be in the same cell as Blake Barker
Each one of those gray background items is associated to a player I noted above. I've checked the IDs. Everything is correct.
I'm quite sure it's not the cleanest code in the world, but below are the two functions.
Code: Select all
// College offers and lists
function college_lists ($colleges,$list,$commit) {
global $pid,$commit;
include(ABSPATH ."resources/con.php");
$query = "SELECT *,p.id as pid,po.playerID as offerID,
GROUP_CONCAT(
CASE
WHEN recruit_type = 'Offer' THEN c.college
END) as offers,
GROUP_CONCAT(
CASE
WHEN recruit_type = 'List' THEN c.college
END) as list,
CASE
WHEN other IS NOT NULL THEN concat(c.college,' (',other,')')
WHEN recruit_type = 'Commit' THEN c.college
END as commit
FROM a_players p
LEFT JOIN a_schools s
ON p.schoolID = s.id
LEFT JOIN a_players_offers po
ON po.playerID = p.id
LEFT JOIN a_colleges c
ON po.collegeID = c.id
WHERE p.id = '". $pid ."'";
// AND other <>'' THEN concat(c.college,' (',other,')')
// ELSE c.college
$results = mysqli_query($con,$query);
while($line = mysqli_fetch_assoc($results)) {
$colleges = $line['offers'];
$commit = $line['commit'];
$list = $line['list'];
if(is_null($commit) && isset($colleges)) {
if(isset($list)) {
echo '[L]';
$offersList = $list;
}
else {
echo '[O]';
$offersList = $colleges;
}
if (isset($colleges)) {
if (isset($list)) {
echo '<div class="list_tooltip"><div class="list_tooltip_header">Final List</div>';
}
else {
echo '<div class="list_tooltip"><div class="list_tooltip_header">Offers</div>';
}
// Turn CSV into unordered list
$offersList = explode(",",$offersList);
asort($offersList);
foreach ($offersList as $offers) {
echo '<div class="list_school">' . $offers;
echo '</div>';
}
echo '</div>';
} // Close the list of colleges check
} // Close List or Offers if
}
}
function committed () {
global $commit;
if($commit) {
echo '<div><span class="commit">'. $commit;
echo '</span></div>';
}
}