0
This question has already scored here and there on the forums and, most of the time, the programmer really was, for several reasons, commanding the Insert twice.
But I guess it’s not my case.
I’m using PHP and accessing an Oracle 11 database.
I have Inserts and selects.
The problem: At each Insert the target table in Oracle shows the same data twice.
I have tried 'n' approaches, without success. My 'output' was to write an absurd code, to search for duplicities and delete them. And I still have one additional problem: deleting the values entirely from the table in Oracle (DELETE FROM MINHATABELA;), directly in sql-editor, yet these data continue to be listed in the PHP select!
My PHP routine that causes the insertion is like this:
<?
require("PDOConnection.php");
$dbh = new PDOConnection();
//....trecho da alimentação das variáveis de insert omitido
$arrayDados = [
'num_pedido' => $numeroPedido,
'email_redator' => $emailRedator,
'email_solicitante' => $emailSolicitante,
'int_setor' => $intSetor,
'int_natureza' => $intNatureza,
'int_programa' => $intPrograma,
'txt_solicitacao' => $txtDescricao,
'data_prevista' => $dataPrevista,
'hora_prevista' =>$txtHoraPrevista,
'intStatus' => 2
];
$sentenca = "INSERT INTO MINHATABELA (num_pedido,email_redator,email_solicitante,int_setor,int_natureza,int_programa,txt_solicitacao,data_prevista,hora_prevista,intStatus)
VALUES (:num_pedido,:email_redator,:email_solicitante,:int_setor,:int_natureza,:int_programa,:txt_solicitacao,:data_prevista,:hora_prevista,:intStatus)";
$resultado=$dbh->insert($sentenca,$arrayDados);
echo $resultado;
?>
My Insert method is like this:
public function insert($sql,$arrayDados) {
$stmt = $this->dbh->prepare($sql);
$stmt->execute($arrayDados);
return $stmt->rowCount();
}//insert
Maybe the problem is how many times the PHP file that causes the insertion is included/required.
– Benilson
In fact, there is no magic, either the Insert is called more than once or it occurs by other means. There is no Trigger that can trigger this other Insert?
– tvdias
@tvdias, there are no triggers, as it is a table created only for testing. It is in the standard of common tables, without operational sophistication.
– user4701
I’ve already modified the. htaccess on Apache not to redirect more than once, I’ve checked (as you suggested) if the favicon check could be computed as an extra call, but none of this interfered.
– user4701