started db-rewrite. using neo4j and a restful go api to handle DB queries/statements.

This commit is contained in:
2025-04-25 23:20:29 -06:00
parent 275e6cb153
commit 693d11c506
13 changed files with 480 additions and 6 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
require_once 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->safeLoad();
// Use environment variables for the database password and IP address.
$db_user = $_ENV['DATABASE_USER'];
$db_pass = $_ENV['DATABASE_PASSWORD'];
$ip_addr = $_ENV['IP_ADDRESS'];
// Make some constants
if ($_SERVER['HTTP_HOST'] == 'localhost') {
define('HOST', 'localhost');
define('USER', $db_user);
define('PASS', $db_pass);
define('DB', 'vintagecoding');
} else {
define('HOST', $ip_addr);
define('USER', $db_user);
define('PASS', $db_pass);
define('DB', 'vintagecoding');
}
function exec_stmt($stmt, $param_types, ...$args)
{
$conn = get_connection();
$stmt = $conn->prepare($stmt);
$stmt->bind_param($param_types, ...$args);
$stmt->execute();
$result = $stmt->get_result();
if ($result)
return $result;
else
return mysqli_insert_id($conn);
}
function get_connection()
{
$conn = new mysqli(HOST, USER, PASS, DB);
return $conn;
}