0
Does anyone know why you’re not showing error if you fail the execute
of prepare
?
$rs = $mysqli->prepare("INSERT INTO tabela (campo1, campo2, campo3) VALUES (?, ?, ?) ");
$rs->bind_param('sss',
$_POST['campo1'],
$_POST['campo2'],
$_POST['campo3']
);
$rs->execute();
if ($rs->errno) {
echo 'Erro: ', $rs->error;
} else {
echo "<script>window.location='PAGINA.php'</script>";
}
There is also the term
errno
, see https://www.php.net/manual/en/mysqli-stmt.errno.php– Tiago
ah yes sorry, I focused only on the PDO
– Luan Brito
I will mark as solved, the problem was prepare, I changed the name of the field and forgot to change the code.
– Tiago