Data update on sqlsrv

Asked

Viewed 55 times

0

Since yesterday I have been having a very strange problem at the time and update data in my BD. I always managed to update data, but I haven’t been able to with this command:

if(isset($_POST['salvarNao'])){
    $acordoo = $_POST['acordoo'];
    $dataProximaAudi = $_POST['dataProximaAudiencia'];

    $dataP = explode('-', $dataProximaAudi);
    $dataProximaAudi = $dataP[0].$dataP[1].$dataP[2];

    $sqlNao = "UPDATE [RDO].[dbo].[reclamatoria] SET acordoNAO='$acordoo', dataProximaAudiencia='$dataProximaAudi' WHERE ID='$id_reclamatoria'";
    $stmt = sqlsrv_query( $conn, $sqlNao );
}

Is there something wrong with my code? the current date I have in the bank is 1900-01-01 00:00:00, field datetime

  • Is there an error? update works directly in the bank? if $dataP is in formatted yyyy-mm-dd don’t need the explosion.

  • No error is presented and if I run straight into the bank, it works! Updates!

  • UPDATE [RDO]. [dbo]. [reclamatoria] SET acordoNAO='No', dataProximaAudiencia='20150122' WHERE ID='96'

  • You have the variable $id_reclamatoria setted? Of a echo in query to see what she’s riding on.

  • I’m doing a separate update. I tried to update a field first, and it didn’t work, and then dataProximaAudiencia and it worked. So the problem is in the agreed field.

  • 1

    I don’t know why, but the field acordoNAO, is not accepting "~" (til), being that it is an nvarchar field(3)... I had to take the pencil to get him into the bank.

Show 1 more comment
No answers

Browser other questions tagged

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