Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <style>
- table {
- background-color: white;
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 100%;
- }
- td, th {
- border: 3px solid grey;
- text-align: left;
- padding: 8px;
- }
- tr:nth-child(even) {
- background-color: darkseagreen;
- }
- </style>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- </head>
- <body>
- <?php
- $servername = "mysql.cba.pl";
- $username = "mmalewski";
- $password = "Haslo123";
- $dbname = "mmalewski";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- echo "<table>";
- echo "<tr><th>Id</th><th>Imię</th><th>Nazwisko</th><th>Wiek</th><th>Płeć</th><th>Zainteresowania</th><th>Opis</th><th>Zdjęcie</th><th>Opcje</th></tr>";
- $sql = "SELECT id, Imie, Nazwisko, Wiek, Plec, Zainteresowania, Opis, Zdjecie FROM DB";
- $image = $row["Zdjecie"];
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- $idd = $row["id"];
- echo "<tr><td>" . $row["id"]. "</td> <td> " . $row["Imie"]. " </td> <td> " . $row["Nazwisko"]. "</td> <td>" . $row["Wiek"]. "</td> <td> " . $row["Plec"]. "</td> <td>" .$row[Zainteresowania]. "</td> <td> " .$row[Opis]. " </td> <td> " .'<a href=getimage.php?id='.$idd.' target=_blank> <img width=75px src="data:image/jpeg;base64,'.base64_encode($row['Zdjecie'] ).'"/> </a>'. "</td> <td> <form> <input type='button' value='Usuń' onclick=window.location.href='delete.php?id=$idd' /> </form> </td></tr><br>";
- }
- } else {
- echo "0 results";
- }
- echo "</table>";
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement