Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1.   <!doctype html>
  2.     <html lang="en">
  3.     <head>
  4.       <meta charset="UTF-8">
  5.       <title>database connections</title>
  6.     </head>
  7.     <body>
  8.       <?php
  9.         $servername = "localhost";
  10.         $username = "code3x10_forms";
  11.         $password = "formsforcode3";
  12.         $dbname = "code3x10_orders";
  13.  
  14.         $conn = mysqli_connect($servername, $username, $password, $dbname);
  15.  
  16.         if (!$conn) {
  17.             die("Connection failed: " . mysqli_connect_error());
  18.         }
  19.  
  20.       //execute the SQL query and return records
  21.       $result = mysql_query("SELECT * FROM project ");
  22.       ?>
  23.       <table border="2" style= "background-color: #84ed86; color: #761a9b; margin: 0 auto;" >
  24.       <thead>
  25.         <tr>
  26.           <th>fname</th>
  27.           <th>lname</th>
  28.         </tr>
  29.       </thead>
  30.       <tbody>
  31.         <?php
  32.           while( $row = mysql_fetch_assoc( $result ) ){
  33.             echo
  34.             "<tr>
  35.              <td>{$row\['fname'\]}</td>
  36.              <td>{$row\['lname'\]}</td>
  37.            </tr>\n";
  38.           }
  39.         ?>
  40.       </tbody>
  41.     </table>
  42.      <?php mysql_close(); //Make sure to close out the database connection ?>
  43.     </body>
  44.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement