I have the following PHP page:
<?php
session_start();
include_once("navbar_op.php");
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>Consulta de OP's por OP</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body{
zoom: 80%;
}
</style>
</head>
<body>
<?php
include_once("conexao.php");
if(!empty($_SESSION['cadastro'])){
if($_SESSION['permite_visualizar'] == 0){
?>
<script language="JavaScript">
window.location="inicial.php";
window.alert("Acesso Negado! Sem permissão!");
</script>
<?php
}
}else{
$_SESSION['msg'] = "Área restrita";
?>
<script language="JavaScript">
window.location="index.php";
window.alert("Area Restrita");
</script>
<noscript>
Se não for direcionado automaticamente, clique <a href="index.php">aqui</a>.
</noscript>
<?php
}
?>
<br>
<div class="row">
<div class="col-md-8">
<h1 align="right">Apontamento de OP's </h1>
</div>
</div>
<h4 align="center">Consulta por OP</h4>
<form method="get" align="center">
<label>OP: </label> <input type="text" name="ops" placeholder="Digite a op a Pesquisar">
<input type="submit" value="Pesquisar">
<input type="text" name="pagina" value="1" hidden>
</form>
<div class="row">
<div class="col-md-4">
<div class="dropdown">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
Exportar
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="exporta_excel_por_op.php">Excel</a>
<a class="dropdown-item" href="#">PDF</a>
<a class="dropdown-item" href="#">TXT</a>
</div>
</div>
</div>
</div>
<?php
$total_reg = "30";
$pagina=$_GET['pagina'];
if (!$pagina) {
$pc = "1";
} else {
$pc = $pagina;
$inicio = $pc - 1;
$inicio = $inicio * $total_reg;
}
if(isset($_GET['ops'])) {
$ops = $_GET['ops'];
}
$_SESSION['ops'] = $ops;
//$ops2 = $_SESSION['ops'];
$todos = mysqli_query($conn ,"SELECT DISTINCT
A.SEQUENCIAL,
A.OP,
A.LOTE,
A.CONTROLE_QUALIDADE_INICIAL,
A.CONTROLE_QUALIDADE_FINAL,
C.REFERENCIA,
C.DESCRICAO,
A.QTD_PECAS,
FORMAT(A.QTD_PECAS / (FORMAT((B.MINUTOS_TRABALHADAS - (TIME_TO_SEC(A.LANCHE)/60) - A.PARADA) / 60,2)),2) AS PECAS_HORA,
FORMAT((B.MINUTOS_TRABALHADAS - MINUTE(A.LANCHE) - A.PARADA) / 60,2) AS HORAS_TRABALHADAS,
A.OPERADORES,
DATE_FORMAT(A.DATA, '%d/%m/%Y') AS DATA,
A.INICIO,
A.FIM,
A.PARADA,
A.MOTIVO,
CASE WHEN A.LANCHE > 0 THEN 'SIM' ELSE 'NÃO' END AS LANCHE
FROM OPS A
JOIN (SELECT DISTINCT A.SEQUENCIAL ,TIMESTAMPDIFF(MINUTE, A.INICIO, A.FIM) AS MINUTOS_TRABALHADAS FROM OPS A) B ON A.SEQUENCIAL = B.SEQUENCIAL
JOIN REFERENCIAS C ON A.REFERENCIA = C.REFERENCIA
WHERE A.OP LIKE '%$ops%' ORDER BY A.CRIACAO DESC");
$resultado = mysqli_query($conn ,"SELECT DISTINCT
A.SEQUENCIAL,
A.OP,
A.LOTE,
A.CONTROLE_QUALIDADE_INICIAL,
A.CONTROLE_QUALIDADE_FINAL,
C.REFERENCIA,
C.DESCRICAO,
A.QTD_PECAS,
FORMAT(A.QTD_PECAS / (FORMAT((B.MINUTOS_TRABALHADAS - (TIME_TO_SEC(A.LANCHE)/60) - A.PARADA) / 60,2)),2) AS PECAS_HORA,
FORMAT((B.MINUTOS_TRABALHADAS - MINUTE(A.LANCHE) - A.PARADA) / 60,2) AS HORAS_TRABALHADAS,
A.OPERADORES,
DATE_FORMAT(A.DATA, '%d/%m/%Y') AS DATA,
A.INICIO,
A.FIM,
A.PARADA,
A.MOTIVO,
CASE WHEN A.LANCHE > 0 THEN 'SIM' ELSE 'NÃO' END AS LANCHE
FROM OPS A
JOIN (SELECT DISTINCT A.SEQUENCIAL ,TIMESTAMPDIFF(MINUTE, A.INICIO, A.FIM) AS MINUTOS_TRABALHADAS FROM OPS A WHERE A.OP LIKE '%$ops%') B ON A.SEQUENCIAL = B.SEQUENCIAL
JOIN REFERENCIAS C ON A.REFERENCIA = C.REFERENCIA
WHERE A.OP LIKE '%$ops%' ORDER BY A.CRIACAO DESC LIMIT $inicio,$total_reg");
$lmite = mysqli_num_rows($resultado);
$tr = mysqli_num_rows($todos);
$tp = $tr / $total_reg;
?>
<?php
$anterior = $pc -1;
$proximo = $pc +1;
if ($pc>1) {
echo " <a href='?pagina=$anterior&ops=$ops'><- Anterior</a> ";
}
echo "|";
if ($pc<$tp) {
echo " <a href='?pagina=$proximo&ops=$ops'>Próxima -></a>";
}
?>
</p>
<div class="responsive-table">
<table class="table table-bordered table-hover">
<thead class="thead-dark">
<th>OP</th>
<th>Lote</th>
<th>Qualidade Inicial</th>
<th>Qualidade Final</th>
<th>Referência</th>
<th>Descrição</th>
<th>Quantidade Peças</th>
<th>Pçs /Hora</th>
<th>Operadores</th>
<th>Data</th>
<th>Hora Início</th>
<th>Hora Término</th>
<th>Minutos Parados</th>
<th>Motivo Parada</th>
<th>Lanche</th>
<th>Excluir</th>
<th>Editar</th>
</thead>
<tbody>
<?php
while ($linhas = mysqli_fetch_array($resultado)) {
$sequencial = $linhas['SEQUENCIAL'];
$qualidade = $linhas['CONTROLE_QUALIDADE_INICIAL'];
$qualidade_quebrada = wordwrap($qualidade, 10, '<br>', true);
$qualidade_fi = $linhas['CONTROLE_QUALIDADE_FINAL'];
$qualidade_quebrada_fi = wordwrap($qualidade_fi, 10, '<br>', true);
echo "<tr>";
echo "<td>".$linhas['OP']."</td>";
echo "<td>".$linhas['LOTE']."</td>";
echo "<td>";echo $qualidade_quebrada;"</td>";
echo "<td>";echo $qualidade_quebrada_fi;"</td>";
echo "<td>".$linhas['REFERENCIA']."</td>";
echo "<td>".$linhas['DESCRICAO']."</td>";
echo "<td>".$linhas['QTD_PECAS']."</td>";
echo "<td>".$linhas['PECAS_HORA']."</td>";
echo "<td height='45'>".$linhas['OPERADORES']."</td>";
echo "<td style='width: 110px'>".$linhas['DATA']."</td>";
echo "<td>".$linhas['INICIO']."</td>";
echo "<td>".$linhas['FIM']."</td>";
echo "<td>".$linhas['PARADA']."</td>";
echo "<td>".$linhas['MOTIVO']."</td>";
echo "<td>".$linhas['LANCHE']."</td>";
echo "<td><a href=''>Excluir</a></td>";
echo "<td><a href='edita_op_por_op.php?sequencial=$sequencial&op=$ops'>Editar</a></td>";
echo "</tr>";
}
?>
</tbody>
</table>
<?php
$anterior = $pc -1;
$proximo = $pc +1;
if ($pc>1) {
echo " <a href='?pagina=$anterior&ops=$ops'><- Anterior</a> ";
}
echo "|";
if ($pc<$tp) {
echo " <a href='?pagina=$proximo&ops=$ops'>Próxima -></a>";
}
?>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
Notice that I put <title>Consulta de OP's por OP</title>
, but when it opens the page, it opens like this:
Does anyone know how to help me with this?
Q: The page will not execute because it has session and includes variables from external files