0
I created a function to modify the data of a DB regarding a particular product:
public function editarProjeto(int $id, int $categoriaID, string $titulo, string $ano, string $descricao, string $arquivo){
$editarProjeto = $this->mysql->prepare("UPDATE tbprojetos SET id_categoria = ?,titulo = ?, ano = ?,, descricao = ?, imagem_main = ? WHERE id = ?");
$editarProjeto->bind_param('issssi', $categoriaID, $titulo, $ano, $descricao, $arquivo, $id);
$editarProjeto->execute();
}
And that is called as follows:
$projetos = new Projeto($mysql);
$updateProjeto = $projetos->editarProjeto($_POST['id'], $_POST['id_categoria'], $_POST['titulo'], $_POST['ano'], $_POST['descricao'], $_FILE['imagem_main']['name']);
}
However, when I submit the data in the form, what it actually does is add a new field to the database with a new ID. What may be happening to not be changing product data of same id?
That’s pretty weird, you can draw up a [mcve]?
– Woss
I made an edit. I took an unnecessary part that uploaded files. Basically it is a product class with a method that updates the product data. The call receives input values from the edit page as parameters.
– Lucas Albuquerque
Are you sure it’s the
editarProjeto
that is being executed? If so, how did it prove this?– Woss