Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getBookTable()
- {
- echo "<table class='book-table' cellspacing='0'>";
- $dbh = new PDO('mysql:host=localhost;dbname=baza', 'root', '');
- $sql = 'SELECT * from books';
- $response = $dbh->query($sql);
- foreach ($response as $row) {
- echo "<tr>
- <td>$row[0]</td>
- <td>$row[1]</td>
- <td>$row[2]</td>
- <td>$row[3]</td>
- <td> <button onclick='deleteEntry($row[0])' >UsuĊ wpis</button></td>
- </tr>";
- }
- echo "</table>";
- echo "<nav aria-label=\"Page navigation\">
- <ul class=\"pagination\">
- <li>
- <a href=\"#\" aria-label=\"Previous\">
- <span aria-hidden=\"true\">«</span>
- </a>
- </li>";
- $entriesCount = $response->columnCount();
- for($i = 0; $i < $entriesCount; $i++) {
- echo "<li><a onclick='getPage($i)'>$i</a></li>";
- }
- echo "<li>
- <a href=\"#\" aria-label=\"Next\">
- <span aria-hidden=\"true\">»</span>
- </a>
- </li>
- </ul>
- </nav>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment