How to send multiple image to DB?

0

Personal as you can see this is a piece of my cod

I'm just sending the name of the property, forget the id_imovel because it is something else, I'm trying to send several images to the db, but when I send to the db it creates 2 times the msm file with the same name, it is not creating 2 lines in db with different names meiu input

public function enviarImagem(){
    foreach ($this->imagem['error'] as $index => $error) {
    $img = "INSERT INTO img(id_imovel, nome) values(:id_imovel, :nome)";
    $stm = $this->con->prepare($img);
    $stm->bindValue(":id_imovel",$this->id);
    $stm->bindValue(":nome",$this->imagem['name'][$error]);

    $stm->execute();
    }

}
    
asked by anonymous 10.04.2018 / 03:57

0 answers