Apparantly no GET variables are used in our system (unless you do an AJAX call) so I’m having problems finding other alternatives. I’m a beginner and tbh I have no idea on how to find alternatives other than using $_GET. Maybe the variable $request_uri(array) would work or load the page with AJAX. Any ideas?
$request_uri array:
if (isset($request_uri[$i1+1]) && $request_uri[$i1+1] != "") {
$setTeam = Teams::setTeamSession($request_uri[$i1+1]);
header('Location: /account/');
}
As I said earlier, I tried to use GET method but it did not work.
$numPerPage = 2;
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = "";
}
if($page == "" || $page == 1){
$start = 0;
} else {
$start = ($page * $numPerPage) - $numPerPage;
}
$countSql = DBi::db3connect()->prepare("SELECT COUNT(a.teamID) FROM userTeams a LEFT JOIN teams b ON a.teamID=b.teamID WHERE a.uID=:uID AND a.active=:active");
$countSql->execute(array(
':uID' => $_SESSION['user']['uID'],
':active' => 1
));
$row = $countSql->fetch();
$numTeams = $row[0];
$numLinks = ceil($numTeams/$numPerPage);
$stmt = DBi::db3connect()->prepare("SELECT a.teamID, b.teamName, b.hashKey FROM userTeams a LEFT JOIN teams b ON a.teamID=b.teamID WHERE a.uID=:uID AND a.active=:active LIMIT $start, $numPerPage");
I think the problem lies below. When I click on the link it takes me to an empty page. It should take me to selectTeam?page=1 instead.
for ($i=1; $i <= $numLinks; $i++){
echo "<li><a href='selectTeam.php?page={$i}'>{$i}</a></li>";
}