BenutzerController_ExpandedAndEnhanced #14
@ -18,9 +18,9 @@ class BenutzerController
|
||||
$this->db = new BenutzerModel();
|
||||
}
|
||||
|
||||
public function getBenutzer($name) {
|
||||
$result = $this->db->selectBenutzer($name);
|
||||
if ($id !== false) {
|
||||
public function getBenutzer() {
|
||||
$result = $this->db->selectBenutzer();
|
||||
if (isset($_GET["name"])) {
|
||||
if ($result)
|
||||
$result = $result[0];
|
||||
else
|
||||
|
@ -9,13 +9,18 @@ use ppb\Library\Msg;
|
||||
|
||||
class BenutzerModel extends Database
|
||||
{
|
||||
public function selectBenutzer($name)
|
||||
public function selectBenutzer()
|
||||
{
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
$params = array();
|
||||
$sql = "SELECT * FROM Benutzerkonto WHERE name = ':name'";
|
||||
$params["name"] = $name;
|
||||
|
||||
$sql = "SELECT * FROM Benutzerkonto";
|
||||
|
||||
if(isset($_GET["name"])){
|
||||
$params[":name"] = $_GET["name"];
|
||||
$sql .= " WHERE name = :name";
|
||||
}
|
||||
|
||||
//Ausführen des SQL befehls
|
||||
try {
|
||||
@ -27,6 +32,7 @@ class BenutzerModel extends Database
|
||||
}
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
//Die Datensätze werden nummeriert
|
||||
foreach ($result as $key => $row) {
|
||||
$result[$key]["id"] += 0;
|
||||
|
Loading…
Reference in New Issue
Block a user