I've tried it in many ways, but all of the problem in the query ...
Exemplo :
<form class="form-inline my-2 my-lg-0" method="post" action="home.php">
<input class="form-control mr-sm-2" type="text" name="palavra"
placeholder="Pesquisar" aria-label="Search"> <button class="btn btn-
outline-
danger my-2 my-sm-0" type="submit">Pesquisar</button>
</form>
<?php
if(isset($_POST['palavra']) != '')
{
$palavra = $_POST['palavra'];
$pesquisa = "where nome like '%palavra%' ";
}
else
{
$pesquisa = '';
}
$querySelect = $link->query("select * from alunos $pesquisa");
$linhas = mysqli_num_rows($querySelect);
echo "Foram encontrados $linhas registros";
echo '<br>';
?>