I need to pass values to my container to make a query

Hello,
I’m new with Slim. I need help with database management. I intend to implement an API on my website. The structure is:

ndapi
app
control
download
routes
vendor
assets
images
views
download
user

In the root directory “ndapi” there is a index.php containing the following (I just put the relevant code related to the database question):

$config[‘db’][‘host’] = “xxx”;
$config[‘db’][‘user’] = “xxx”;
$config[‘db’][‘pass’] = “xxx”;
$config[‘db’][‘dbname’] = “xxx”;

$app = new \Slim\App([“settings” => $config]);
$container = $app->getContainer();
$container[‘view’] = new \Slim\Views\PhpRenderer(“views/”);

$container[‘db’] = function ($c) {
$db = $c[‘settings’][‘db’];
$pdo = new PDO(“mysql:host=” . $db[‘host’] . “;dbname=” . $db[‘dbname’], $db[‘user’], $db[‘pass’]);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
return $pdo;
};

I have an user area. The user.php file contained in app/routes does this:

$this->map([‘GET’, ‘POST’], ‘/myaccount’, function (Request $request, Response $response)
{
$posVars = $request->getParsedBody();
$sql = “SELECT email, pwd FROM downloadTest WHERE email = :email AND pwd = :code”;
$statement = $this->db->prepare($sql);
$statement->bindParam(’:email’, $posVars[‘email’]);
$statement->bindParam(’:code’, $posVars[‘pwd’]);
$statement->execute();
$row = $statement->fetch();
if (!$row) {
$response = $this->view->render($response, “user/login.html”, []);
return $response;
}
$response = $this->view->render($response, “user/myaccount.html”, [“data” => $row]);
return $response;
});

Then, in ndapi/views/user I have a login.php file with an email/pwd form. The submit button reloads the page and collects the values entered by the user in $ _POST [].

The question is, How do I make a call to the database? I have the email, I have the pwd, have the connection to the database and the query but not how to send the values to the database. In summary, how I connect login.php with user.php?

I hope I explained.

Thank you very much in advance,

Greetings

Myself.
Sorry, the structure is:
ndapi
app
control
download
routes
vendor
assets
images
views
download
user

Ok,
I put an image.