Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = $_GET['dbhost'];
- $db_user = $_GET['dbuser'];
- $db_password = $_GET['dbpassword'];
- $db_name = $_GET['dbname'];
- $tablename = $_GET['tablename'];
- error_reporting(0);
- /* nazwy kolumn */
- $conn = new mysqli($host, $db_user, $db_password);
- $stmt = $conn->prepare("SELECT column_name FROM information_schema.columns WHERE table_name=?");
- $stmt->bind_param('s', $tablename);
- $stmt->execute();
- $stmt->bind_result($table);
- $stmt->store_result();
- echo "<tr>";
- while($stmt->fetch()) {
- echo "<th>".$table."</th>";
- }
- echo "</tr>";
- $stmt->close();
- /* zawartość tabeli */
- $stmt2 = mysqli_connect($host, $db_user, $db_password, $db_name);
- $result = $stmt2 -> query("SELECT * FROM ".$tablename);
- foreach($result as $row){
- echo "<tr>";
- foreach($row as $field){
- echo "<td>".$field."</td>";
- }
- echo "</tr>";
- }
- $stmt2->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement