Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <style>
  4. table {
  5. background-color: white;
  6. font-family: arial, sans-serif;
  7. border-collapse: collapse;
  8. width: 100%;
  9. }
  10.  
  11. td, th {
  12. border: 3px solid grey;
  13. text-align: left;
  14. padding: 8px;
  15. }
  16.  
  17. tr:nth-child(even) {
  18. background-color: darkseagreen;
  19. }
  20. </style>
  21.  
  22. <head>
  23. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  24. </head>
  25. <body>
  26. <?php
  27.  
  28. $servername = "mysql.cba.pl";
  29. $username = "mmalewski";
  30. $password = "Haslo123";
  31. $dbname = "mmalewski";
  32.  
  33. $conn = new mysqli($servername, $username, $password, $dbname);
  34. if ($conn->connect_error) {
  35. die("Connection failed: " . $conn->connect_error);
  36. }
  37.  
  38. echo "<table>";
  39. 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>";
  40. $sql = "SELECT id, Imie, Nazwisko, Wiek, Plec, Zainteresowania, Opis, Zdjecie FROM DB";
  41. $image = $row["Zdjecie"];
  42. $result = $conn->query($sql);
  43. if ($result->num_rows > 0) {
  44.  
  45. while($row = $result->fetch_assoc()) {
  46. $idd = $row["id"];
  47. 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>";
  48. }
  49. } else {
  50. echo "0 results";
  51. }
  52.  
  53. echo "</table>";
  54. $conn->close();
  55. ?>
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement