From 2b63ba42caa2e7664ed2e06d63ac3893ee80cd8e Mon Sep 17 00:00:00 2001 From: absurdo Date: Sat, 28 Oct 2023 01:38:24 +0200 Subject: [PATCH] Added update method --- src/WPDO.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/WPDO.php b/src/WPDO.php index 09d8187..15bb768 100644 --- a/src/WPDO.php +++ b/src/WPDO.php @@ -185,6 +185,33 @@ class WPDO { } + public function update($fields, $values_update, $where_sql, $values) { + + $fields=$this->check_fields($fields); + + if(count($fields)!=count($values_update)) { + + throw new Exception('No valid values for insert in '.$this->table->name); + + } + + //$final_fields=implode('`, `', $fields); + $final_fields=[]; + + foreach($fields as $field) { + + + + } + + $query='update '.$this->table->name.' SET '; + //echo $query; + $this->sth=$this->conn->prepare($query); + + return $this->sth->execute($values); + + } + public function check_fields($fields) { if($fields[0]!='*') {