Workaround for no data and TN4?

Workaround for no data and TN4?

JokerDanJokerDan Posts: 4Questions: 0Answers: 0
edited September 2015 in Free community support

ISSUE 1 SELF RESOLVED--

Another issue, is when navigating to a page that does not yet have any data in the table; see;
http://77.103.67.102/fantasyleaguefootball.co.uk/divisions/info/Division_2
I get the popup warning but am unsure as to how to work around this when there is intentionally no data yet supplied. https://www.datatables.net/manual/tech-notes/4

The table intentionally has no data in, so what do?


function getInfo($leagueName) { if ($leagueName == "") { header("Location:" . _URL_ . "divisions"); } else { $output = ""; $findDivisionQuery = "SELECT id FROM divisions WHERE name LIKE '%" . $leagueName . "%' AND active = TRUE"; $findDivisionResult = $this->db->query($findDivisionQuery); $foundDivision = $findDivisionResult->fetch(PDO::FETCH_OBJ); if ($foundDivision != NULL) { $divisionID = $foundDivision->id; $divInfoFields = ["u.displayname", "u.xbox_gamertag AS xgt", "t.name AS team", "t.badge_url", "utd.wins", "utd.losses", "utd.draws", "utd.goals_for", "utd.goals_against", "utd.points", "SUM(utd.goals_for - utd.goals_against) AS goaldiff"]; $divisionInfoQuery = "SELECT " . Database::setFields($divInfoFields) . "FROM user_to_division utd " . "LEFT JOIN users u ON utd.user_id = u.id " . "LEFT JOIN teams t ON utd.team_id = t.id " . "WHERE utd.division_id = " . $divisionID . " " . "GROUP BY utd.id " . "ORDER BY utd.points DESC, goaldiff DESC"; $divisionInfoResult = $this->db->query($divisionInfoQuery); //return $divisionInfoQuery; if (isset($divisionInfoResult)) { $position = 1; while ($infoObj = $divisionInfoResult->fetch(PDO::FETCH_OBJ)) { $badgeUrl = $infoObj->badge_url != NULL ? _URL_ . _IMG_ . $infoObj->badge_url : _URL_ . _IMG_ . "team_badges/placeholder.png"; $gamesPlayed = $infoObj->wins + $infoObj->draws + $infoObj->losses; $output .= "<tr>" . "<td class=\"alc\">" . $position . "</td>" . "<td class=\"\">" . (isset($infoObj->xgt) ? $infoObj->xgt : "-") . "</td>" . "<td class=\"\">" . (isset($infoObj->team) ? $infoObj->team : "-") . "</td>" . "<td class=\"palc\"><img class=\"team-badge\"src=\"" . $badgeUrl . "\" /></td>" . "<td class=\"alc\">" . $gamesPlayed . "</td>" . "<td class=\"alc\">" . (isset($infoObj->wins) ? $infoObj->wins : "-") . "</td>" . "<td class=\"alc\">" . (isset($infoObj->draws) ? $infoObj->draws : "-") . "</td>" . "<td class=\"alc\">" . (isset($infoObj->losses) ? $infoObj->losses : "-") . "</td>" . "<td class=\"alc\">" . (isset($infoObj->points) ? $infoObj->points : "-") . "</td>" . "<td class=\"alc\">" . (isset($infoObj->goaldiff) ? $infoObj->goaldiff : "-") . "</td>" . "<td class=\"alc\"><a class=\"pointer\"><i class=\"fa fa-user fw\"></i></a> : <a class=\"pointer\"><i class=\"fa fa-bar-chart\"></i></a></td>" . "</tr>"; $position += 1; } } else { return "There has been a problem, please refresh the page or contact an administrator."; } if ($output != NULL) { return $output; } else { return "<tr><td colspan=\"5\">No Records Found...</td></tr>"; } } else { header("Location:" . _URL_ . "divisions"); } } }
This discussion has been closed.