Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8">
- <title>zad</title>
- </head>
- <body>
- <?php
- $serverName="localhost";
- $userName="root";
- $pass="";
- $dbName="bazavod";
- $conn=mysqli_connect($serverName,$userName,$pass,$dbName);
- if(!$conn){
- die("błąd połączenia z serwerem lub bazą danych".
- mysql_connect_error());
- }
- echo "połączenie z bazą jest ok<br>";
- $sql="select gatunek,tytul from filmy where gatunek='familijny'";
- $wynik=mysqli_query($conn,$sql);
- if ($wynik){
- echo"pytanie okej";
- //sprawdzamy czy jest cos wyswietlenia
- if(mysqli_num_rows($wynik)>0) {
- echo"sa wiersze do wyswietlenia";
- $str="<table border=1>";
- while($row=mysqli_fetch_assoc($wynik))
- {
- $str.="<tr><td>".$row["gatunek"]." </td><td> ".$row["tytul"]." </td><td>";
- }
- $str.="</table>";
- echo $str;
- }
- else{
- echo"nie ma wierszy do wyswietlenia";
- }
- }
- else{
- echo"blad w pytaniu!";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement