Subversion Repository Public Repository

Nextrek

Diff Revisions 299 vs 300 for /Android/SmartCharging/endPoints/CommentRepository.php

Diff revisions: vs.
  @@ -26,13 +26,13 @@
26 26 $this->db->exec($queryComment);
27 27 $id_commento = $this->db->lastInsertId();
28 28
29 - foreach($imgs as $img) {
29 + /*foreach($imgs as $img) {
30 30 $imgsToInsert[] = '("'.$id_commento.'", "'.$img.'")';
31 31 }
32 32
33 33 $queryImgs = "INSERT INTO immagini_commenti(id_commento, img) VALUES" . implode(',', $imgsToInsert);
34 34
35 - $this->db->exec($queryImgs);
35 + $this->db->exec($queryImgs);*/
36 36
37 37 $status["id"] = $id_commento;
38 38 $status["return"] = 0;
  @@ -148,7 +148,7 @@
148 148 }
149 149 }
150 150
151 - public function addImage($id_comment, $img) {
151 + /*public function addImage($id_comment, $img) {
152 152 $sql = "INSERT INTO immagini_commenti(id_commento, img)
153 153 VALUES (".$id_comment.",'".$img."')";
154 154
  @@ -158,6 +158,24 @@
158 158 } catch (PDOException $e) {
159 159 echo $e->getMessage();
160 160 return 1;
161 + }
162 + }*/
163 +
164 + public function addImages($id_comment, $imgs) {
165 + try {
166 + foreach($imgs as $img) {
167 + $imgsToInsert[] = '("'.$id_locale.'", "'.$img.'")';
168 + }
169 +
170 + $queryImgs = "INSERT INTO immagini_commenti(id_commento, img) VALUES" . implode(',', $imgsToInsert);
171 + //echo "<br/>".$queryImgs."<br/>";
172 +
173 + $this->db->exec($queryImgs);
174 + return 0;
175 +
176 + } catch (PDOException $e) {
177 + echo $e->getMessage();
178 + return 1;
161 179 }
162 180 }
163 181