0
I’m trying the following: I need the code below first to check that the record that is trying to be finalized (Pass status 1 to 2) is not finished. If you do not follow the NORMAL UPDATE. But what happens is that when I try to finalize a record that is already in the bank with status 2 that is Finalized, gives the message that it can not finish and such, but when I try to finalize a record that is active, which is status 1 in the bank and which should then UPDATE run and pass to 2, does not contain anything. Note: (Running only UPDATE without test it works normal).
<?php
@ini_set('display_errors', '1');
error_reporting(E_ALL);
if(file_exists("../config.php")) {
require "../config.php";
} else {
echo "Arquivo config.php nao foi encontrado";
exit;
}
$id = $_GET["id"];
settype($id, "integer");
Abre_Conexao();
//status
if($id){
/*STATUS: 1 = ATIVO, 2 = FINALIZADO*/
$sqlstatus = "SELECT * FROM projetos WHERE STATUS_PROJETO = '2' AND COD_PROJETO = $id";
$resultadost = mysql_query($sqlstatus) or die(mysql_error());
while($linha = mysql_fetch_assoc($resultadost)) {
if($linha['STATUS_PROJETO'] > '0')
echo "Atividade já estava finalizada";
}
} else {
mysql_query("UPDATE projetos SET status_projeto = '2' where cod_projeto = $id");
mysql_close();
header("Location: projetos.php");
}
?>
That if
if($linha['STATUS_PROJETO'] > '0')
shouldn’t beif($linha['STATUS_PROJETO'] == 2)
. There is aSTATUS_PROJETO
zero?– rray
It really should be like this, but I adjusted and now returns a blank page (only with PDO connection error, but this is because of the method I used). @rray
– TiagoIB
But you’re not using the PDO.
– rray
No. To with the old connection, but this error ta giving on other pages, it would not be the problem.
– TiagoIB
I could update the question code. It’s a bit confusing, look at the
if($id){
when it comes to Else supposedly has no id in this case you update, update which id? When testing all commentsheader(....);
– rray