Fixed treating successful mysql queries as error when warnings are generated

This commit is contained in:
Frank Schubert
2025-01-30 20:50:37 +01:00
parent 96ad013c67
commit 20ee71f599
2 changed files with 9 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ class FronkDB {
private $lastError;
private $log;
public $insert_id;
private static $instances = [];
//private static $instance;
@@ -71,6 +73,9 @@ class FronkDB {
}
public function query($sql, $print_error = false) {
// unset last insert id on qvery new query
$this->insert_id = null;
if(!$this->link) {
$this->connect();
}
@@ -103,6 +108,8 @@ class FronkDB {
$this->log->warn("SQL Last Error: ".$this->lastError);
}
$this->insert_id = mysqli_insert_id($this->link);
// check for warnings
if(mysqli_warning_count($this->link) > 0) {
$log_query = true;

View File

@@ -185,7 +185,8 @@ class mfBaseModel {
}
} else {
if($this->db->insert($this->table, $fields, $forcestr)) {
$id = mysqli_insert_id($this->db->link);
$id = $this->db->insert_id;
var_dump($id);
$this->id = $id;
$this->saved++;
if(method_exists($this, "afterSave")) {