Files
internal_api/lib/C3GovConnector.php
2026-08-07 23:56:02 +02:00

38 lines
1.1 KiB
PHP

<?php
namespace lib;
class C3GovConnector
{
private $config;
private $dbConnection;
public function __construct(){
$this->config = parse_ini_file("../.env", true);
$this->dbConnection = new \mysqli($this->config['DB_HOST'], $this->config['DB_USER'], $this->config['DB_PASS'], $this->config['DB_NAME']);
$this->dbConnection->set_charset("utf8");
}
public function getPreApplication($referenceNumber){
$sql = "SELECT * FROM pre_applications WHERE reference_number = ?";
$stmt = $this->dbConnection->prepare($sql);
$stmt->bind_param("s", $referenceNumber);
$stmt->execute();
$result = $stmt->get_result();
return $result->fetch_assoc();
}
public function getCos($testId){
$sql = "SELECT * FROM cos WHERE testId = ?";
$stmt = $this->dbConnection->prepare($sql);
$stmt->bind_param("s", $testId);
$stmt->execute();
$result = $stmt->get_result();
return $result->fetch_assoc();
}
public function __destruct() {
$this->dbConnection->close();
}
}