<?php // query.php
  require_once 'login.php';
  $conn = new mysqli($hn, $un, $pw, $db);
  if ($conn->connect_error) die($conn->connect_error);

  $query  = "SELECT * FROM classics";
  $result = $conn->query($query);
  if (!$result) die($conn->error);

  $rows = $result->num_rows;

  for ($j = 0 ; $j < $rows ; ++$j)
  {
    $result->data_seek($j);
    echo 'Autor: '     . $result->fetch_assoc()['author']   . '<br>';
    $result->data_seek($j);
    echo 'Tytuł: '     . $result->fetch_assoc()['title']    . '<br>';
    $result->data_seek($j);
    echo 'Kategoria: ' . $result->fetch_assoc()['category'] . '<br>';
    $result->data_seek($j);
    echo 'Rok: '       . $result->fetch_assoc()['year']     . '<br>';
    $result->data_seek($j);
    echo 'ISBN: '      . $result->fetch_assoc()['isbn']     . '<br><br>';
  }

  $result->close();
  $conn->close();
?>
