Пример #1
0
 public function insertGallery(Projeto $project)
 {
     $result = $this->connect->begin_transaction(MYSQLI_TRANS_START_READ_WRITE);
     $result = $this->connect->query("INSERT INTO projeto(name,description,local,category,customer,datinha) VALUES ('" . $project->getName() . "','" . $project->getDescription() . "','" . $project->getLocal() . "'," . $project->getCategory() . ",'" . $project->getCustomer() . "','" . $project->getDate() . "')");
     $query_imagem_temp = "INSERT INTO imagem(nome,projeto) VALUES";
     $imagem = $project->getImage();
     if (count($imagem) > 0) {
         foreach ($imagem as $key => $value) {
             $query_imagem_temp .= " ('" . $value . "'," . $this->connect->insert_id . "),";
         }
         $query_imagem = substr($query_imagem_temp, 0, -1);
         $result = $this->connect->query($query_imagem);
     }
     $this->connect->commit();
     return $query_imagem;
 }