Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. require_once "conecta.php";
  4.  
  5. $resultado = mysqli_query($conexao, "select * from curtida");
  6. $curtida = mysqli_fetch_assoc($resultado);
  7. ?>
  8.  
  9. <!DOCTYPE html>
  10. <html lang="pt-br">
  11. <head>
  12. <meta charset="UTF-8" />
  13. <title>Curtir</title>
  14. <link rel="stylesheet" href="css/claudina.css" />
  15. </head>
  16. <body>
  17. <section class="recipiente margem-topo-50">
  18. <form action="envia_curtir.php" method="post">
  19. <input type="number" name="curtida" />
  20. <button class="icones icone-polegares-para-cima"></button>
  21. <?=$curtida['curtidas'];?>
  22. </form>
  23. </section>
  24. </body>
  25. </html>
  26.  
  27. <?php
  28.  
  29. require_once "conecta.php";
  30. require_once "funcoes.php";
  31.  
  32. $curtida = $_POST['curtida'];
  33.  
  34. curtir($conexao, $curtida);
  35.  
  36. header("Location: index.php");
  37.  
  38. ?>
  39.  
  40. funcoes.php
  41.  
  42. <?php
  43.  
  44. function curtir($conexao, $curtida) {
  45.  
  46. $query = "update curtida set curtidas= $curtida";
  47.  
  48. return mysqli_query($conexao, $query);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement