Jump to content
Fórum Script Brasil
  • 0

Aparecendo os Insert ao inserir


Andryon PHProgrammer

Question

5 answers to this question

Recommended Posts

  • 0

<?

// Requisições de Arquivos Externos //

require_once( "../../classes/defines.php" );

//require_once( "../../classes/permissoes.php" );

require_once( "../../classes/template.php" );

require_once( "../../classes/DAO/AreaDAO.php" );

require_once( "../../classes/DAO/CurriculoDAO.php" );

require_once( "../../classes/Utils/Util.php" );

// ================================ //

// Instanciando Objetos //

$oUtil = new Util();

$oArea = new AreaDAO();

$oCurriculo = new CurriculoDAO();

// ==================== //

// Declaração de Variáveis //

$NAOCONCLUIDO = NULL;

// ======================= //

$DT = date("Y-m-d H:i:s");

// Gravp PDI //

$iQryh = "UPDATE TB_AVALIACAO_RESPOSTA_USUARIO "

. "SET ARU_ACTECNICA = '$_POST[final1]', "

. "ARU_RESTECNICA = '$_POST[final2]', "

. "ARU_PRATECNICA = '$_POST[final3]', "

. "ARU_ACGERENCIAL = '$_POST[final4]', "

. "ARU_RESGERENCIAL = '$_POST[final5]', "

. "ARU_PRAGERENCIAL = '$_POST[final6]', "

. "ARU_ACRCA = '$_POST[final7]', "

. "ARU_RESRCA = '$_POST[final8]', "

. "ARU_PRARCA = '$_POST[final9]', "

. "ARU_DTFIM = '$DT' "

. "WHERE CRR_ID = $_POST[CRR_ID] AND AVL_ID = $_POST[AVL_ID] ";

$PQry = mysql_query( $iQryh ) or die( mysql_error() );

//print $rQryh;

//exit;

// ========= //

$AVALIADOR = isset( $_GET["AVALIADOR"] ) ? $_GET["AVALIADOR"] : NULL;

$EHAVL = $_POST["EHAVL"];

// Percorro todos os campos //

for ($i = 1; $i <= $_POST['numero']; $i++){

$Tema = 'Tema'.$i;

$Fator = 'Fator'.$i;

$AVH_ID = "AVH_ID".$i;

if ($EHAVL == "não"){

}else{

$Avaliador = 'Avaliador'.$i;

if ($_POST[$Avaliador] == 0){

$NAOCONCLUIDO = 1;

}

//AVALIADOR

$sQryF = "SELECT AVR_ID FROM TB_AVALIACAO_RESPOSTA WHERE ARU_ID = $_POST[ARU_ID] AND AVL_ID = $_POST[AVL_ID] "

. "AND AVT_ID = $_POST[$Tema] AND AVF_ID = $_POST[$Fator] AND AVH_ID = $_POST[$AVH_ID] ";

// . "AND AVF_VLR_AVALIADOR IS NOT NULL";

$fQry = mysql_query( $sQryF ) or die( mysql_error() );

if (mysql_num_rows($fQry)){

//UPDATE

$rQryh = "UPDATE TB_AVALIACAO_RESPOSTA SET AVF_VLR_AVALIADOR = $_POST[$Avaliador] "

. "WHERE ARU_ID = $_POST[ARU_ID] AND AVL_ID = $_POST[AVL_ID] "

. "AND AVT_ID = $_POST[$Tema] AND AVF_ID = $_POST[$Fator] AND AVH_ID = $_POST[$AVH_ID]";

$EQry = mysql_query( $rQryh ) or die( mysql_error() );

}else{

if ($_POST[$Avaliador] == 0){

}else{

$rQryh = "INSERT INTO TB_AVALIACAO_RESPOSTA (ARU_ID, AVL_ID, AVT_ID, AVF_ID, AVH_ID, AVF_VLR_AVALIADOR) "

. "VALUES ($_POST[ARU_ID], $_POST[AVL_ID], $_POST[$Tema] , $_POST[$Fator], $_POST[$AVH_ID], "

. "$_POST[$Avaliador])";

$EQry = mysql_query( $rQryh ) or die( mysql_error() );

/*print "<script>

alert ('Dados gravados com sucesso!');

window.location = 'cCurriculo.php';

</script>";*/

}

}

}

if ($EHAVL == "SIM"){

}else{

//AVALIADO

$Avaliado = 'Avaliado'.$i;

if ($_POST[$Avaliado] == 0){

$NAOCONCLUIDO = 1;

}

$sQryF = "SELECT AVR_ID FROM TB_AVALIACAO_RESPOSTA WHERE ARU_ID = $_POST[ARU_ID] AND AVL_ID = $_POST[AVL_ID] "

. "AND AVT_ID = $_POST[$Tema] AND AVF_ID = $_POST[$Fator] AND AVH_ID = $_POST[$AVH_ID] ";

$fQry = mysql_query( $sQryF ) or die( mysql_error() );

if (mysql_num_rows($fQry)){

//UPDATE

$rQryh = "UPDATE TB_AVALIACAO_RESPOSTA SET AVF_VLR_AVALIADO = $_POST[$Avaliado] "

. "WHERE ARU_ID = $_POST[ARU_ID] AND AVL_ID = $_POST[AVL_ID] "

. "AND AVT_ID = $_POST[$Tema] AND AVF_ID = $_POST[$Fator] AND AVH_ID = $_POST[$AVH_ID]";

print $rQryh;

$EQry = mysql_query( $rQryh ) or die( mysql_error() );

}else{

if ($_POST[$Avaliado] == 0){

}else{

$rQryh = "INSERT INTO TB_AVALIACAO_RESPOSTA (ARU_ID, AVL_ID, AVT_ID, AVF_ID, AVH_ID, AVF_VLR_AVALIADO) "

. "VALUES ($_POST[ARU_ID], $_POST[AVL_ID], $_POST[$Tema] , $_POST[$Fator], $_POST[$AVH_ID], "

. "$_POST[$Avaliado])";

$EQry = mysql_query( $rQryh ) or die( mysql_error() );

/*print "<script>

alert ('Dados gravados com sucesso!');

window.location = 'cCurriculo.php';

</script>";*/

}

}

}

if ($EHAVL == "não"){

}else{

//NOtA FINAL

$NotaFinal = 'NotaFinal'.$i;

if ($_POST[$NotaFinal] == 0){

$NAOCONCLUIDO = 1;

}

$sQryF = "SELECT AVR_ID FROM TB_AVALIACAO_RESPOSTA WHERE ARU_ID = $_POST[ARU_ID] AND AVL_ID = $_POST[AVL_ID] "

. "AND AVT_ID = $_POST[$Tema] AND AVF_ID = $_POST[$Fator] AND AVH_ID = $_POST[$AVH_ID] ";

$fQry = mysql_query( $sQryF ) or die( mysql_error() );

if (mysql_num_rows($fQry)){

//UPDATE

$rQryh = "UPDATE TB_AVALIACAO_RESPOSTA SET AVF_VLR_FINAL = $_POST[$NotaFinal] "

. "WHERE ARU_ID = $_POST[ARU_ID] AND AVL_ID = $_POST[AVL_ID] "

. "AND AVT_ID = $_POST[$Tema] AND AVF_ID = $_POST[$Fator] AND AVH_ID = $_POST[$AVH_ID]";

$EQry = mysql_query( $rQryh ) or die( mysql_error() );

}else{

if ($_POST[$NotaFinal] == 0){

}else{

$rQryh = "INSERT INTO TB_AVALIACAO_RESPOSTA (ARU_ID, AVL_ID, AVT_ID, AVF_ID, AVH_ID, AVF_VLR_FINAL) "

. "VALUES ($_POST[ARU_ID], $_POST[AVL_ID], $_POST[$Tema] , $_POST[$Fator], $_POST[$AVH_ID], "

. "$_POST[$NotaFinal])";

$EQry = mysql_query( $rQryh ) or die( mysql_error() );

}

}

}

}

if ($NAOCONCLUIDO){

//Altero status para incompleta

$bQryh = "UPDATE TB_AVALIACAO_RESPOSTA_USUARIO SET ARU_STATUS='2' WHERE AVL_ID= $_POST[AVL_ID] AND CRR_ID = $_POST[CRR_ID]";

$BQry = mysql_query( $bQryh ) or die( mysql_error() );

}else{

$NAOCONCLUIDO = 0;

//Se concluiu altero altero status

$bQryh = "UPDATE TB_AVALIACAO_RESPOSTA_USUARIO SET ARU_STATUS='5' WHERE AVL_ID= $_POST[AVL_ID] AND CRR_ID = $_POST[CRR_ID]";

$BQry = mysql_query( $bQryh ) or die( mysql_error() );

}

echo "<script>window.location = 'rAvaliacao.php?Conclusao=$NAOCONCLUIDO';</script>";

// ======================== //

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...