1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

better handling of db connections, return timestamp for found builds

This commit is contained in:
andreas
2023-10-02 18:43:43 +02:00
parent 7a5da47e17
commit 707c00b850
3 changed files with 53 additions and 13 deletions

View File

@@ -1,4 +1,17 @@
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
include("../../../cibuild_db.php");
function openDb(){
if (! defined('database::SERVER')) return null;
try{
$db=new mysqli(database::SERVER, database::USER, database::PASS,database::DB);
$db->query("SET CHARACTER SET 'utf8'");
return $db;
}catch (Exception $e){
error_log("openDB error $e");
}
return null;
}
function safeName($name)
{
return preg_replace('[^0-9_a-zA-Z.-]', '', $name);