Advertisement
Guest User

123

a guest
Dec 7th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="Stylesheet" type="text/css" href="style.css" />
  6. </head>
  7. <body>
  8.  
  9. <div id="container">
  10. <div id="banner"><h1></h1></div>
  11. <div id="left"><ul><li><a href="filmy.php">film</a></li>
  12. <li><a href="klienci.php">klienci</a></li>
  13. <li><a href="wypozyczenia.php">wypozyczenia</a></li>
  14. </ul></div>
  15. <div id="right">
  16. <?php
  17. $serwername="localhost";
  18. $username="root";
  19. $password="";
  20. $dbname="video";
  21.  
  22. $conn=mysqli_connect($serwername,$username,$password,$dbname );
  23. if($conn){
  24. echo "poloczona z baza <br>";
  25.  
  26. $sql = "SELECT filmy.Gatunek, COUNT(filmy.Gatunek) FROM `filmy`, `wypozyczenia` WHERE filmy.ID_filmu=wypozyczenia.ID_filmu GROUP BY filmy.Gatunek ORDER BY COUNT(filmy.Gatunek) DESC LIMIT 1";
  27. $wynik = mysqli_query($conn, $sql);
  28. if(mysqli_num_rows($wynik)> 0){
  29.  
  30. while($row=mysqli_fetch_assoc($wynik)){
  31. echo "gatunek: ".$row['Gatunek']."<br>";
  32. echo " ilosc: ".$row['COUNT(filmy.Gatunek)']."<br>";
  33. }
  34.  
  35.  
  36.  
  37. }
  38.  
  39. }
  40. else {
  41. die ("brak poloczenia".mysqli_connect_error());
  42. }
  43.  
  44.  
  45. ?>
  46.  
  47. </div>
  48. <div id="footer"><center>niemiec</center></div>
  49. </div>
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement