Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Paginacja za pomocą mysqli_fetch_object
slawekxx
post
Post #1





Grupa: Zarejestrowani
Postów: 189
Pomógł: 2
Dołączył: 28.08.2010

Ostrzeżenie: (0%)
-----


Witam, trochę czasu spędziłem na stronicowaniu skryptu licznik kliknięć , a mianowicie licznik ten wyświetla miniaturki zdjęć jest ich dość dużo sam skrypt wygląda tak plik index
  1. include("conn.php");
  2. $sql = mysqli_query($link, "SELECT id,image,post_date,title,duration,download FROM wp_my_plugin GROUP BY post_date DESC ");
  3. while($result = mysqli_fetch_object($sql)):
  4. ?>
  5.  
  6. <a border="0" href="counter.php?id=<?php echo $result->id; ?>" class="gals-box MultimediaItem MMID_216667" ">
  7. <img border="0" src="<?php echo $result->image; ?>"width="90" height="56" ><strong><?php echo $result->title; ?>
  8. </strong><em><?php echo $result->duration; ?></em>
  9. </a>
  10.  
  11. <?php
drugi plik counter.php
  1. //1. include the configuration file
  2. include("conn.php");
  3.  
  4. //2. Get the id from the url and store it into a variable
  5. $id = mysqli_real_escape_string($link, $_GET['id']);
  6.  
  7. //3. fetch the url and clicks from this banner
  8. $clicks = mysqli_fetch_object(mysqli_query($link, "SELECT image,hd,download FROM wp_my_plugin WHERE id=".$id.""));
  9.  
  10. //4. increase clicks with 1
  11. $new_click = $clicks->download+1;
  12.  
  13. //5. update this into the database, check if it was succesfull
  14. if(mysqli_query($link, "UPDATE wp_my_plugin SET up_post_date=NOW(),download=".$new_click." WHERE id=".$id."")):
  15. //6. redirect to the url
  16.  
  17. header("Location: ".$clicks->hd);
  18. else:
  19. //6. else write to error log
  20. endif;


i nie mam pojęcia jak zrobić do tego stronicowanie .

Ten post edytował slawekxx 24.07.2011, 12:16:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 2.10.2025 - 16:56