Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $servername = "localhost";
- $username = "root";
- $password = "mekaanikko";
- $dbname = "TESTI";
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT Name, Address, Phone, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Comment FROM Form";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- echo "<table style='width=100%'>"
- echo "<tr><th>Name</th><th>Address</th><th>Phone</th><th>Q1</th><th>Q2</th><th>Q3</th><th>Q4</th><th>Q5</th><th>Q6</th><th>Q7</th><th>Comment</th></tr>"
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>$row["Name"]</td>";
- echo "<td>$row["Address"]</td>";
- echo "<td>$row["Phone"]</td>";
- echo "<td>$row["Q1"]</td>";
- echo "<td>$row["Q2"]</td>";
- echo "<td>$row["Q3"]</td>";
- echo "<td>$row["Q4"]</td>";
- echo "<td>$row["Q5"]</td>";
- echo "<td>$row["Q6"]</td>";
- echo "<td>$row["Q7"]</td>";
- echo "<td>$row["Comment"]</td>";
- echo "</tr>";
- }
- echo "</table>"
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement