0
Hello, I’m doing my first PDO code but when I am running the code, it brings me a mistake that I have no idea what it is, I appreciate the help from now.
<?php
session_start();
include('conn_prod.php');
$SendCadImg = filter_input(INPUT_POST, 'SendCadImg', FILTER_SANITIZE_STRING);
if ($SendCadImg) {
# code...
$id_nec = filter_input(INPUT_POST, 'tema', FILTER_SANITIZE_STRING);
$tema = filter_input(INPUT_POST, 'tema', FILTER_SANITIZE_STRING);
$nome_img = $_FILES['arquivo']['name'];
$result_img = "INSERT INTO necessaires (id_nec, tema, imagem, data) VALUES (:id_nec, :tema, :nome_img, NOW())";
$insert_img = $conn_prod->prepare($result_img);
$insert_img->bindParam(':id_nec', $id_nec);
$insert_img->bindParam(':tema', $tema);
$insert_img->bindParam(':imagem', $nome_img);
$insert_img->execute();
} else {
$_SESSION['img'] = "<p>Erro ao salvar oo dados</p>";
header("Location: produtos.php");
}
?>
And what’s the mistake?
– Vinicius De Jesus
Warning: Pdostatement::execute(): SQLSTATE[HY093]: Invalid Parameter number: Parameter was not defined in C: xampp htdocs Control panel processa_prod.php on line 18
– Leonardo Jordano
There is no parameter ":image", but ":im_name". see if this solves.
– Vinicius De Jesus
it was such a stupid mistake that I let escape kkk worked yes thank you very much.
– Leonardo Jordano