2026-03-09 07:12:13 +01:00

42 lines
1.2 KiB
PHP

<?php
include_once '../config/constants.php';
class DBTableObject
{
// database connection and table name
protected $conn;
protected $table_name = "";
protected $array_key = "";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// constructor with $db as database connection
public function __construct($db)
{
$this->conn = $db;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public function toArray () : array
{
return array();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public function getResultArray ($status, $message) : array
{
return array (
"status" => $status,
"message" => $message,
$this->array_key => $this->toArray()
);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public function executeQuery ($query)
{
$stmt = $this->conn->prepare($query);
$stmt->execute();
return $stmt;
}
}
?>