Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <link rel="Stylesheet" type="text/css" href="style.css" />
- </head>
- <body>
- <div id="container">
- <div id="banner"><h1></h1></div>
- <div id="left"><ul><li><a href="filmy.php">film</a></li>
- <li><a href="klienci.php">klienci</a></li>
- <li><a href="wypozyczenia.php">wypozyczenia</a></li>
- </ul></div>
- <div id="right">
- <?php
- $serwername="localhost";
- $username="root";
- $password="";
- $dbname="video";
- $conn=mysqli_connect($serwername,$username,$password,$dbname );
- if($conn){
- echo "poloczona z baza <br>";
- $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";
- $wynik = mysqli_query($conn, $sql);
- if(mysqli_num_rows($wynik)> 0){
- while($row=mysqli_fetch_assoc($wynik)){
- echo "gatunek: ".$row['Gatunek']."<br>";
- echo " ilosc: ".$row['COUNT(filmy.Gatunek)']."<br>";
- }
- }
- }
- else {
- die ("brak poloczenia".mysqli_connect_error());
- }
- ?>
- </div>
- <div id="footer"><center>niemiec</center></div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement