update table with Foreign key

Asked

Viewed 191 times

1

I am trying to update a table with foreign keys, precisely in foreign keys I want to leave them with value NULL update but I’m not getting this is my query:

$sql = 'UPDATE agenda SET id_pessoa=:id_pessoa ,id_tp_pessoa=:id_tp_pessoa ';
$sql .= 'WHERE id_agenda = :id_agenda';

$stm = $conexao->prepare($sql);
$stm->bindValue(':id_pessoa', $id_pessoa);

$stm->bindValue(':id_tp_pessoa', $id_tp_pessoa);


$stm->bindValue(':id_agenda', $id_agenda);
$retorno = $stm->execute();
  • And what is your doubt?

  • Why aren’t you getting it? Some mistake?

  • It may be that some field does not accept null in the database, thus preventing its update.

  • Sergio, your question is incomplete. What exactly happens? Error messages?

  • sorry delay . error was in the bank was not set NULL. my Sorry fault :(

No answers

Browser other questions tagged

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