My code is this:
<?php
$buscarusuario=$pdo->prepare("SELECT * FROM top5 WHERE status = 'ativo' ORDER BY colocacao ASC");
$buscarusuario->execute();
// Exibir com Fetch_Obj
$linha=$buscarusuario->fetchAll(PDO::FETCH_OBJ);
foreach ($linha as $listar) {
?>
<!-- INÍCIO TOP -->
<div class="col-md-12 wow fadeInLeft" data-wow-duration="1000ms" data-wow-delay="300ms">
<div id="top5-caixa">
<div class="colocacao">
<?php echo $listar->colocacao; ?>
</div>
<div class="musica-cantor">
<p class="cantor"><?php echo $listar->cantor; ?></p>
<p class="musica"><?php echo $listar->titulo; ?></p>
</div>
<div class="like">
<a href='extra/likes.php?id=<?php echo "".$listar->id.""; ?>' alt="Gostei"><img src="images/like.png" height="40px" width="40px" id="like"></a>
</div>
</div>
</div><!-- ./ COL-MD-12 -->
<?php } ?>
</div><!-- ./ ROW -->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Inserir dados PDO</title>
</head>
<body>
<?php
// Incluindo arquivo de conexão
include("conexao.php");
$pdo = conectar();
// Recuperando valores
$id = $_GET['id'];
// Realizando consulta
$atualizartop=$pdo->prepare("UPDATE top5 SET likes = likes +1 WHERE ID='$id'");
$atualizartop->bindValue(":id",$id);
$atualizartop->execute();
if($atualizartop->rowCount() > 0):
echo "Obrigado por votar!";
else:
echo "Desculpe, mas ocorreu algum erro.";
endif;
?>
</body>
</html>
I wonder if clicking on the link to vote would have to return a "Thanks for voting!" without having to upgrade to the page that has the php function.
If anyone knows how to help thank you.