Prepare Shows no error

Asked

Viewed 24 times

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>";
}

1 answer

1


  • There is also the term errno, see https://www.php.net/manual/en/mysqli-stmt.errno.php

  • ah yes sorry, I focused only on the PDO

  • I will mark as solved, the problem was prepare, I changed the name of the field and forgot to change the code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.