I'm creating a search.php
for my system, so far everything is OK, however in the while
that I created to show future questions that hit with the searched title and their respective links, nothing appears on the page.
No SQL error or anything, simply does not return any data.
I'd like to see a better view in SQL to see if there are any errors below in the search or how to display with while
.
<?php
require_once("php/conexao.php");
if (isset($_GET['search'])) {
$textoBusca = $_GET['search'];
$strSQL = "SELECT * FROM questoes WHERE titulo LIKE '".$textoBusca."'";
$result = mysqli_query($conexao, $strSQL);
?>
<div class="row">
<div class="col-lg-12 text-center">
<div class="page-header texto-pesquisa">
<h2>Você buscou por "<?php echo $textoBusca; ?>"</h2>
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12 text-center">
<?php
while($row = mysqli_fetch_assoc($result)) {
$artigos = $row['titulo'];
?>
<p><?php echo $artigos; ?></p>
<?php } ?> <!-- fecha o while -->
</div>
</div>
<!-- /.row -->
<?php } ?> <!-- Fecha o IF -->