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