I'm having trouble fetching data by name. The following is the code. Thanks in advance.
<?php include_once 'dbconfig.php'; ?>
<?php include_once 'header3.php'; ?>
<div class="clearfix"></div>
<div class="container" style=" background-color:#69C">
<legend style="color:#FFF" align="center"><h2>Resultado da Busca por Nome</h2></legend>
<form action="" method="get" id='form-contato' class="form-horizontal col-md-10">
<label class="col-md-2 control-label" for="termo" style="color:#FFFFFF">Pesquisar</label>
<div class='col-md-7'>
<input type="text" class="form-control" id="nome" name="nome" placeholder="Infome o Nome">
</div>
<button type="submit" class="btn btn-primary">Pesquisar</button>
<a href='index.php' class="btn btn-primary">Ver Todos</a>
</form>
</div><!--container-->
<div class="clearfix"></div><br />
<div class="container">
<table class='table table-hover table-border table-responsive'>
<tr bgcolor="#99CCFF">
<th>#</th>
<th>Nome</th>
<th>Sobrenome</th>
<th>Email</th>
<th>Telefone</th>
<th colspan="2" align="center">Ação</th>
</tr>
<?php
$nome=(isset($_GET['nome']));
if(!empty($nome))
{
$sql = "SELECT * FROM dbpdo.tbl_usuarios WHERE nome LIKE :nome OR email LIKE :email";
$stm = $DB_con->prepare($sql);
$stm->bindValue(":nome", $nome);
$stm->bindValue(":email", $nome);
$stm->execute();
if($stm->rowCount()>0)
{
while($row=$stm->fetchAll(PDO::FETCH_OBJ))
{
?>
<tr>
<td><?php print($row['id']); ?></td>
<td><?php print($row['nome']); ?></td>
<td><?php print($row['sobrenome']); ?></td>
<td><?php print($row['email']); ?></td>
<td><?php print($row['telefone']); ?></td>
<td align="center">
<a href="edit-data.php?edit_id=<?php print($row['id']); ?>"><i class="glyphicon glyphicon-edit"></i></a>
</td>
<td align="center">
<a href="delete.php?delete_id=<?php print($row['id']); ?>"><i class="glyphicon glyphicon-trash"></i></a>
</td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td>Não existem dados para visualizar!</td>
</tr>
<?php
}
}
?>
</table>
</div><!--container-->
<?php include_once 'footer.php';?>