0
I’m using the require
on this page of mine, so the result is being printed after the footer, someone would tell me how to solve, follow the code:
<?php
require ("principal.php");
$servidor = "localhost";
$usuario = "root";
$senha = "root";
$tabela = "guianortecapixaba";
$conexao = new mysqli($servidor, $usuario, $senha, $tabela);
if ($conexao->connect_error) {
die("Erro: " . $conexao->connect_error);
}
$busca = $_POST['palavra'];
$cidade = $_POST ['cidade'];
$sql = "SELECT * FROM empresa WHERE nome LIKE '%$busca%' AND cidade = '$cidade'";
$resultados = $conexao->query($sql);
if ($resultados->num_rows > 0) {
while($linha = mysqli_fetch_array($resultados)) {
print("<strong>Nome: </strong>" . $linha['nome'] . "</br>");
print ("<strong>Endereço: </strong>" . $linha['endereco']."</br>");
if( isset($_POST['cidade']) && $_POST['cidade'] === 'sao-gabriel-da-palha' ) {
$fromPerson = 'São Gabriel da Palha';
echo "<strong>Cidade: </strong>".$fromPerson."</br>";
}
print ("<strong>Telefone: </strong>" . $linha['telefone']."</br>");
echo "<strong>email: </strong>". $linha['email']."</br>";
echo "<hr>";
}
} else {
echo "Nenhum resultado para a sua busca.";
}
$conexao->close();
?>
It’s quite simple your footer is inside the main.php I suppose .... and the execution is being done later, interesting would be to take this php block to a separate file and make include where it should bring the result
– Otto
Give an example there because I could not, I’m still learning so such difficulties
– WPfan
Edit the question and add the footer part where the information should appear so I can help you
– Otto
It is not in the footer that the information is to appear, but in the main column of the page, so the information is being printed after the footer
– WPfan
Answered see if it helps you
– Otto