This commit is contained in:
2023-09-22 17:58:31 +00:00
parent 37c67baa21
commit 0ef9e2a1f4
19 changed files with 1172 additions and 176 deletions

View File

@@ -1,5 +1,5 @@
<?php
require_once ($ruta ?? "./") . "vendor/autoload.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/vendor/autoload.php";
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
use \SeinopSys\PostgresDb;
@@ -40,7 +40,7 @@ function query(string $sql, array $params = null, bool $single = true)
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
$response = $single ? $stmt->fetch(PDO::FETCH_ASSOC) : $stmt->fetchAll(PDO::FETCH_ASSOC);
$response = $single ? $stmt->fetch(PDO::FETCH_ASSOC) : $stmt->fetchAll(PDO::FETCH_ASSOC);
return $response;
} catch (PDOException $e) {
@@ -60,4 +60,4 @@ function queryAll(string $sql, array $params = null)
function toSQLArray(array $array): string
{
return sprintf("{%s}", implode(", ", $array));
}
}