Add: DatabaseService class for abstracted database operations

- Created DatabaseService.php with full OOP database abstraction layer
- Methods: select(), selectOne(), insert(), update(), delete(), execute(), count(), exists()
- Transaction support: beginTransaction(), commit(), rollback()
- Error handling: getLastError(), getLastQuery() for debugging
- Type-safe parameter binding with prepared statements
- Updated connection.php to initialize $db service
- Available globally as $db variable after connection.php include
- Foundation for migrating from procedural $conn queries
This commit is contained in:
twotalesanimation
2025-12-03 19:59:32 +02:00
parent 45523720ea
commit 0143f5dd12
2 changed files with 324 additions and 0 deletions

View File

@@ -13,3 +13,7 @@ if(!$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname)){
}
date_default_timezone_set('Africa/Johannesburg');
// Initialize DatabaseService for modern queries
require_once(__DIR__ . '/classes/DatabaseService.php');
$db = new DatabaseService($conn);