MySQL

Tregimi i të dhënave me stile CSS

Love Will Tear Us Apart

Joy Division (1980)

Killing Me Softly With His Song

The Fugees (1996)

Barbara Ann

The Beach Boys (1966)

The Day the Rains Came

Jane Morgan (1958)

PHP
<div class="mbajtesi-me-demonstrim">
<?php
// lidhja me serverin:
$lidhja = new mysqli ("adresa-e-serverit", "perdoruesi", "fjalekalimi", "baza_e_te_dhenave");
mysqli_set_charset ($lidhja, "utf8");
if ($lidhja -> connect_error) {die ("Error: " . $lidhja->connect_error);}
// tregimi i të dhënave nga tabela:
$kerkesa = "SELECT * FROM kenget_top_5000 ORDER BY RAND() LIMIT 0, 6";
$rezultati = $lidhja -> query($kerkesa);
if ($rezultati -> num_rows > 0) {
while ($rreshti = $rezultati -> fetch_assoc()) {
echo "<h1>" . $rreshti["titulli"] . "</h1>";
echo "<h2>" . $rreshti["artisti"] . " (" . $rreshti["viti"] . ")" . "</h2>"; 
}
} 
else {
echo "Nuk mund të tregohet asnjë e dhënë.";
}
$lidhja -> close(); // mbylle lidhjen
?>
</div>
CSS
.mbajtesi-me-demonstrim {
  font-family: "Roboto Condensed", sans-serif;
  font-weight: 400;
  font-style: normal;
  padding: 2rem 1rem 1rem 1rem;
  line-height: 1em;
  color: rgba(0, 0, 0, 0.64); 
} 

.mbajtesi-me-demonstrim h1 {
  font-size: 1.2em;
  font-weight: 400;
  background-color: rgba(255, 255, 255, 1);
  margin: 0;
  padding: 4px 10px;
}

.mbajtesi-me-demonstrim h2 {
  font-size: 1em;
  font-weight: normal;
  background-color: rgba(129, 209, 180, 1);
  color: rgba(255, 255, 255, 1);
  margin: 0 0 20px 0;
  padding: 4px 10px;
  text-align: right;
}