0
<?php
require_once("banco-produtos.php");
require_once("logicaUsuario.php");
verificaUsuario();
require_once("header.php");
$id = $_POST['id'];
removeProduto($conexao, $id);
$_SESSION["success"] = "Produto removido com sucesso";
header("Location:estoque.php");
die();
logicaUsuario.php
function verificaUsuario(){
if (!usuarioEstaLogado()){
$_SESSION["error"] = "Você não tem acesso a essa funcionalidade";
header("Location:index.php");
die();
};
};
php database.
require_once("conexao.php");
function removeProduto($conexao, $id){
$query = "delete from produtos where id = {$id}";
return mysqli_query($conexao, $query);
};
Error_log
Warning: Cannot modify header information - headers already sent by (output started at /home/comunica/public_html/testes/murilo/phpI/header.php:23) in /home/comunica/public_html/testes/murilo/phpI/remove-produto.php on line 11
I followed the tips given in two other questions, one mine and another that had been marked as duplicate of the previous, but none of them solved my problem, I’ve modified the code as many times as possible, I tried to put the header()
and/or user verification.
@Wallacemaxters, read the description of the question, I already tried to use what they had put in this other question there, but it did not work, it keeps generating this error...
– Murilo Melo
I have read the description of the question and have come to the conclusion that it is duplicated. All possible causes for the problem are reported in this question in the duplication reference. If you are experiencing another problem, you need to go into more detail.
– Wallace Maxters
I know they are reported, I followed what was there and still continued the same mistake
– Murilo Melo
Murilo, but honestly, did you see how many answers there are in the other question? Are you sure you tried everything and it didn’t work? The solution to the problem is that, there is no other explanation. Even, if this is the case, your question would be closed in the same way, if you do not know how to report in detail the problem occurred (we could close as "this problem cannot be reproduced").
– Wallace Maxters
Maybe you have another problem that is not described in the question, like another file with a blank code at the beginning. A good test to be done is to give a
CTRL+U
on the error page and see if there is nothing being sent to the browser before (this is spoken in one of the linked responses)– Wallace Maxters
tried dude, I’m since 10:40 in the morning trying to solve this problem, had some other smaller that I solved, but just missing that same
– Murilo Melo