id/common/database.php

28 lines
435 B
PHP
Raw Normal View History

2024-06-28 21:41:35 +00:00
<?php
function db_execute($sql, $variables=[]) {
global $pdo;
$stmt = $pdo->prepare($sql);
$stmt->execute($variables);
return $stmt->fetch();
}
function db_execute_all($sql, $variables=[]): bool|array
{
global $pdo;
$stmt = $pdo->prepare($sql);
$stmt->execute($variables);
return $stmt->fetchAll();
}
function db_query($sql): bool|PDOStatement
{
global $pdo;
return $pdo->query($sql);
}