Advertisement
Guest User

Untitled

a guest
Jul 31st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <!-- connect.php -->
  2. <?php
  3. $host = "localhost";
  4. $user = "root";
  5. $db = "fenix";
  6. $pass = "";
  7.  
  8. try{
  9. $connect = new PDO("mysql:host=$host;dbname=$db",$user,$pass);
  10. }catch(PDOException $e){
  11. die("Error ".$e->getMessage());
  12. }
  13.  
  14. <!-- index.php -->
  15. <?php
  16. require_once("connect.php");
  17. ?>
  18.  
  19. <script type="text/javascript">
  20. $(document).ready(function(){
  21. $("#carregar_mais").click(function(){
  22. <?php $limite = $limite + 9;?>
  23. });
  24. });
  25. </script>
  26.  
  27. <?php
  28. $results = $connect->query("SELECT * FROM arquivo ORDER BY id_arquivo DESC LIMIT $limite");
  29. ?>
  30.  
  31. <div class="imagens">
  32. <?php
  33. while($row = $results->fetch(){ ?>
  34. <a href="upload/uploads/<?php echo $row['nome_arquivo'];?>" >
  35. <img class="imagem" src="upload/uploads/<?php echo $row['nome_arquivo'];?>" />
  36. </a>
  37. <?php } ?>
  38. </div>
  39.  
  40. <center>
  41. <p id="carregar_mais" style="color:white; cursor:pointer;">Carregar mais</p>
  42. <?php echo $limite;?> <!-- Este echo é só para exibir em quanto está meu LIMIT-->
  43. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement