Conditions | 3 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
71 | public function update(string $table, array $data, string $terms, string $parse) |
||
72 | { |
||
73 | $this->table = $table; |
||
74 | $this->terms = $terms; |
||
75 | $this->data = $data; |
||
76 | parse_str($parse, $this->statements); |
||
77 | |||
78 | foreach ($data as $key => $value){ |
||
79 | $this->places[] = $key.' = :'.$key; |
||
80 | |||
81 | } |
||
82 | |||
83 | $this->places = implode(', ', $this->places); |
||
84 | |||
85 | $this->update = "UPDATE {$this->table} SET {$this->places} {$this->terms}"; |
||
86 | |||
87 | try{ |
||
88 | $this->result = DB::connect()->prepare($this->update); |
||
89 | $this->result->execute(array_merge($this->data, $this->statements)); |
||
90 | $this->error = true; |
||
91 | |||
92 | |||
93 | }catch (\PDOException $e){ |
||
94 | echo $e->getMessage(); |
||
95 | |||
101 | } |