Facebook
From Tinct Guinea Pig, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 179
  1. <?php
  2. $db = new mysqli('localhost', 'root', '', 'baza');
  3.  
  4. if($db->connect_errno > 0)
  5. {
  6.     die('Unable to connect to database [' . $db->connect_error . ']');
  7. }
  8. $sql = <<<SQL
  9.     SELECT *
  10.     FROM `ogloszenia`
  11. SQL;
  12.  
  13. if(!$result = $db->query($sql)){
  14.     die('There was an error running the query [' . $db->error . ']');
  15. }
  16. echo '<table align="center" border="1" >';
  17. echo '<tr><td>ID</td><td>Nazwisko</td><td>Imie</td><td>Pesel</td><td>Adres</td><td>Numer</td><td>Miasto</td></tr>';
  18. while($row = $result->fetch_assoc())
  19. {
  20.     echo '<tr>' . '<td>' . $row['id_ucz'] . '</td><td>'.  $row['nazwisko'] . '</td><td>' . $row['imie'] . '</td><td>'. $row['pesel'] . '</td><td>'. $row['adres_ul'] . '</td><td>'. $row['adres_nr'] . '</td><td>' . $row['miasto'] . '</td>' .' </tr>' . '<br />';
  21. }
  22. echo '</table>';
  23. ?>