0
I have the following PHP page:
<?php
session_start();
?>
<!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
}
include_once("navbar_op.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 * FROM MT_OPS
WHERE OP LIKE '%$ops%' ORDER BY CRIACAO DESC");
$resultado = mysqli_query($conn ,"SELECT * FROM MT_OPS A
WHERE OP LIKE '%$ops%' ORDER BY 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>
I have another screen where the references are registered and it registers everything in capital letters in the database. However, when I open the page above, the description has the special character in minússculo, for example: CAMINHãO
Can anyone tell why this happens or a fix for it?
friend uses php strtoupper() function.
– Maycon F. Castro
Could show how this character is in the database?
– Woss
This way it is in the bank: prntscr.com/jzka7y
– maiconfriedel
@Maikeaerosmith Este
Ã
that appears in the bank is not theÃ
of your word; your bank is coding problem, probably because it is poorly configured. See more on Doubt with charset=iso-8859-1 and utf8.– Woss
I managed with the help of @Mayconf.Castro, using mb_strtoupper($lines['DESCRICAO'], 'UTF-8')
– maiconfriedel
@Maikeaerosmith But this will not solve your problem, it will only mask it. Correct the encodings of your project and you will have no more problem with it in life.
– Woss