Made $db global

This commit is contained in:
Lars van Hijfte
2017-01-19 11:57:54 +01:00
parent b71cf36798
commit 186cdf1445
14 changed files with 58 additions and 79 deletions

View File

@@ -61,9 +61,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
if (!empty($_POST["actions"]) && !empty($_POST["userID"])) {
changeUserStatusByID($db, $_POST["userID"], $_POST["actions"]);
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
} elseif (!empty($_POST["actions"]) && !empty($_POST["groupID"])) {
changeGroupStatusByID($db, $_POST["groupID"], $_POST["actions"]);
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
}
}
@@ -183,7 +183,7 @@ function test_input($data) {
<!-- Table construction via php PDO. -->
<?php
if ($pagetype == 'user') {
$q = search20UsersFromNByStatus($db, $listnr, $search, $status);
$q = search20UsersFromNByStatus($listnr, $search, $status);
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
$userID = $user['userID'];
@@ -218,7 +218,7 @@ function test_input($data) {
");
}
} else {
$q = search20GroupsFromNByStatus($db, $listnr, $search, $groupstatus);
$q = search20GroupsFromNByStatus($listnr, $search, $groupstatus);
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
$groupID = $group['groupID'];

View File

@@ -6,11 +6,8 @@
<?php
include_once("../queries/friendship.php");
if (empty($_SESSION["userID"]))
$_SESSION["userID"] = 2;
// Get all the friends of a user.
$friends = selectAllFriends($db, $_SESSION["userID"]);
$friends = selectAllFriends($_SESSION["userID"]);
$i = 0;
// Print all the users.

View File

@@ -9,11 +9,8 @@
// Load file.
include_once("../queries/friendship.php");
if (empty($_SESSION["userID"]))
$_SESSION["userID"] = 2;
// Get all the friends of a user.
$friends = selectAllFriends($db, $_SESSION["userID"]);
$friends = selectAllFriends($_SESSION["userID"]);
$i = 0;
// Print all the users.
@@ -69,7 +66,7 @@
include_once("../queries/group_member.php");
// Get all the friends of a user.
$groups = selectAllGroupsFromUser($db, $_SESSION["userID"]);
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
$i = 0;
// Print all the users.