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

  $query  = "DESCRIBE koty";
  $result = $conn->query($query);
  if (!$result) die ("Brak dostępu do bazy danych: " . $conn->error);

  $rows = $result->num_rows;
  echo "<table><tr><th>Kolumna</th><th>Typ</th><th>Null</th><th>Klucz</th></tr>";

  for ($j = 0 ; $j < $rows ; ++$j)
  {
    $result->data_seek($j);
    $row = $result->fetch_array(MYSQLI_NUM);

    echo "<tr>";
    for ($k = 0 ; $k < 4 ; ++$k) echo "<td>$row[$k]</td>";
    echo "</tr>";
  }

  echo "</table>";
?>
