Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>database connections</title>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "code3x10_forms";
- $password = "formsforcode3";
- $dbname = "code3x10_orders";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- //execute the SQL query and return records
- $result = mysql_query("SELECT * FROM project ");
- ?>
- <table border="2" style= "background-color: #84ed86; color: #761a9b; margin: 0 auto;" >
- <thead>
- <tr>
- <th>fname</th>
- <th>lname</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while( $row = mysql_fetch_assoc( $result ) ){
- echo
- "<tr>
- <td>{$row\['fname'\]}</td>
- <td>{$row\['lname'\]}</td>
- </tr>\n";
- }
- ?>
- </tbody>
- </table>
- <?php mysql_close(); //Make sure to close out the database connection ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement