@@ -167,12 +167,13 @@ $app->get('/order/{id}', function (Request $request, Response $response, array $ | |||
return $response; | |||
}); | |||
// put this in src db | |||
$app->get('/customers', function (Request $request, Response $response, array $args) { | |||
$db = new DB(); | |||
$sql = "SELECT * FROM clients"; | |||
$stmt = $db->prepare($sql); | |||
$res = $stmt->execute(); | |||
$response->getBody()->write("<h1>CUSTOMERS LIST </h1>"); | |||
$response->getBody()->write('<hr/>'); |
@@ -0,0 +1,11 @@ | |||
<?php | |||
use Shop\DB\DB; | |||
class Customers extends DB { | |||
public function customers(){ | |||
$stmt= $this->prepare("SELECT * FROM clients"); | |||
$res = $stmt->execute(); | |||
return $res; | |||
} | |||
} |