Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Results</title>
- </head>
- <body>
- <div id = "results"></div>
- <a href = "/">Back to Form</a>
- </body>
- <?php
- $host_name = '///////';
- $database = '///////';
- $user_name = '///////';
- $password = '////////';
- $link = new mysqli($host_name, $user_name, $password, $database);
- if ($link->connect_error) {
- die('<p>Failed to connect to MySQL: '. $link->connect_error .'</p>');
- } else {
- echo '<p>Connection to MySQL server successfully established.</p>';
- }
- $first_name = $_REQUEST['firstName'];
- $last_name = $_REQUEST['lastName'];
- $email = $_REQUEST['Email'];
- $username = $_REQUEST['userName'];
- $password = $_REQUEST['Password'];
- $sql = "CREATE TABLE info (
- id INT(8) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- firstname VARCHAR(30) NOT NULL,
- lastname VARCHAR(30) NOT NULL,
- email VARCHAR(50),
- username VARCHAR(30) NOT NULL,
- pass VARCHAR(30) NOT NULL,
- )";
- $insert = "INSERT INTO info VALUES ('$first_name','$last_name','$email','$username','$password')";
- $selected = "SELECT * FROM info";
- $result = $link->query($selected);
- echo "<table>"; // start a table tag in the HTML
- while($row = $result->fetch_assoc()){ //Creates a loop to loop through results
- echo "<tr><td>" . $row['id'] . "</td><td>" . $row['firstname'] . "</td><td>" . $row['lastname'] . "</td> <td>" . $row['email'] . "</td> <td>" . $row['username'] . "</td> <td>" . $row['pass'] . "</td></tr>";}
- echo "</table>"; //Close the table in HTML
- ?>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement