From 165ded7cac7e872d8ccef457cbe2fc708ed60356 Mon Sep 17 00:00:00 2001 From: "tristan.champomier" Date: Fri, 1 Oct 2021 09:53:40 +0200 Subject: [PATCH] Added ability to pass an array of datas in PDO::sql_query() --- lib/system/system_data_source/database/mypdo.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/system/system_data_source/database/mypdo.php b/lib/system/system_data_source/database/mypdo.php index bf4994f..d02c75f 100755 --- a/lib/system/system_data_source/database/mypdo.php +++ b/lib/system/system_data_source/database/mypdo.php @@ -227,7 +227,7 @@ class mypdo extends Database * @return result renvoie un pointeur de resultat ou faux si erreur de requete */ - function sql_query($query = "", $transaction = FALSE) + function sql_query($query = "", $data=false, $transaction = FALSE) { $query=Database::rewriteQuery($query); //echo $query."
"; @@ -240,7 +240,10 @@ class mypdo extends Database // $this->query_result = $this->db_connect->query($query); $this->query_result = $this->db_connect->prepare($query); - $this->query_result->execute(); + if( !$data ) + $this->query_result->execute(); + else + $this->query_result->execute($data); } if(isset($this->query_result)) // if (!$this->query_result = $this->db_connect->query($query))