cleaned up the code

This commit is contained in:
2019-09-24 17:02:26 +02:00
parent bf27d735fe
commit 984d44ac75
4 changed files with 30 additions and 27 deletions

View File

@@ -6,7 +6,12 @@ class DBBoard extends Database{
$con = self::connectToDB();
$query = $con->prepare("SELECT * FROM board");
$query->execute();
return $query->fetchAll(PDO::FETCH_BOTH);
$boardArray = [];
while($result = $query->fetch(PDO::FETCH_BOTH)){
$board = new Board($result['ID'],$result['name'],$result['permLevel']);
array_push($boardArray, $board);
}
return $boardArray;
}
}