Registration is not updated in the database

Asked

Viewed 50 times

0

I have an application that takes the content of a given site and compares if it is different from the current one comparing to the record in the database and sends an email that had a change, in addition to updating in the database with the new content to be used in the next check.

It was working properly the feature, but now stopped for good.

But it was not the first time that this problem occurred, I had to put a ibase_commit to update correctly in the bank. And it has to do with the method below, since I passed a String to test directly in the method call and the record was not updated and the method is always called since I put a echo 'ok' and returned at CMD.

Follow the Controller function:

    public function update($codigo, $conteudo){

        $connect = OpenConnection();    

        $query = ibase_query($connect, "UPDATE CAD_SITES SET CONTEUDO = ?, DATA_ENVIO_EMAIL = ?, HORA_ENVIO_EMAIL = ? WHERE CODIGO = ?", 'Teste', date('d-m-Y'), date('G:i:s'), $codigo);
        $result = false;

        if ($query){
            $result = ibase_commit($connect);
            if($result){
              echo "Alterou";
            } else {
              echo "Não alterou";  
            }
        }

        if (ibase_errmsg()){
            $result = '[ERRO] '.ibase_errmsg();
        }

        return $result;         

    }
  • 1

    Apparently the bank’s auto commit is off.

  • And how can I call? And it couldn’t work with ibase_commit even if the bank was disconnected?

  • 1

    Yes it should work, test if the ibase_commit($connect); returns true.

  • Returns true to condition, I will change the above code with it.

  • I took the update of the date and time and it worked, now it remains to know how to update the date and time in the correct way.

  • 1

    So, date it like date('Y-m-d');

Show 1 more comment
No answers

Browser other questions tagged

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