PHP and Mysql - UPDATE error

Asked

Viewed 63 times

0

On my client’s website, which is programmed in PHP and uses Mysql, users must fill out employee evaluation data. But in two moments, I received notifications from users who will continue the reviews and have their data "lost". In this case to continue the evaluations, when registering the data in the table of the Mysql database, UPDATE instructions are used.

Looking at the Mysql table records, this "lost" data is set to zero (when the fields are numeric), empty (when they are characters), and calendar dates 0000-00-00.

Below is a more brief example of this UPDATE statement in Mysql:

$sql = "UPDATE wt_aval_avaliacao_analista SET
    autonomia = '".$_POST['autonomia']."', autonomiaexemplo = '".$_POST['autonomiaExemplo']."',
    autonomiagestor = '".$_POST['autonomiagestor']."', autonomiaexemplogestor = '".$_POST['autonomiaExemploGestor']."',
    autonomiaconsenso = '".$_POST['autonomiaconsenso']."', autonomiaexemploconsenso = '".$_POST['autonomiaExemploConsenso']."',
    agilidade = '".$_POST['agilidade']."', agilidadeexemplo = '".$_POST['agilidadeExemplo']."',
    agilidadegestor = '".$_POST['agilidadegestor']."', agilidadeexemplogestor = '".$_POST['agilidadeExemploGestor']."',
    agilidadeconsenso = '".$_POST['agilidadeconsenso']."', agilidadeexemploconsenso = '".$_POST['agilidadeExemploConsenso']."',
    carreira1 = '".$_POST['carreira1']."', carreira2 = '".$_POST['carreira2']."', carreira3 = '".$_POST['carreira3']."',
    carreira4 = '".$_POST['carreira4']."', carreira5 = '".$_POST['carreira5']."', carreira6 = '".$_POST['carreira6']."',
    resultados = '".$_POST['resultados']."', resultadosrelacao = '".$_POST['resultadosrelacao']."',
    comentarioscolaborador = '".$_POST['comentarioscolaborador']."',
    comentariosgestor = '".$_POST['comentariosgestor']."',
    comentariosgerente = '".$_POST['comentariosgerente']."',
    concluido = '".$concluir."'
    WHERE idperiodo = " . $_SESSION['idPeriodo'] . " AND idcolaboradoravaliado = " . $_SESSION['idColaborador'];

    $q = Doctrine_Manager::getInstance()->getCurrentConnection();
    $q->execute($sql);

What can happen to cause this failure in the Mysql UPDATE statement? Is it related to how long the user is logged in? Something related to memory, browser that is used, table configuration?

  • By the code you posted, the session would only make a difference in the values that go on where, the rest are being recovered by $_POST so no matter how long the user stays in the browser. In the cases of "lost" data you mentioned, all table fields are like this or only a few?

  • @Ricardopunctual Yes, all the fields end up like this.

No answers

Browser other questions tagged

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