Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = new mysqli('localhost', 'ej', '1234', 'navnet_paa_databasen');
- $tables = array();
- $rs = $db->query("SHOW TABLES");
- while ($row = $rs->fetch_row())
- $tables[] = $row[0];
- foreach ($tables as $table) {
- echo '<h1>Data fra ' . $table . '</h1>';
- echo '<table style="width: 100%;"><thead>';
- echo '<tr>';
- $cols = array();
- $rs = $db->query("SHOW COLUMNS FROM $table");
- while ($row = $rs->fetch_row()) {
- echo '<td>', $row[0] ,'</td>';
- }
- echo '</thead></tr>';
- $rs = $db->query("SELECT * FROM $table");
- while ($row = $rs->fetch_assoc()) {
- echo '<tr>';
- foreach ($row as $field)
- echo '<td>', $field ,'</td>';
- echo '</tr>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment