Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>Example 71</title>
- </head>
- <body>
- <?php
- # Connect to a database and access a table
- $dbname = 'ce154_ss18960'; // Please set this to your database, e.g. ce154_username
- $dbuser = 'root';
- $dbpass = "";
- $dbhost = 'localhost';
- $link = mysqli_connect( $dbhost, $dbuser, $dbpass )
- or die( "Unable to Connect to '$dbhost'" );
- mysqli_select_db( $link, $dbname )
- or die("Could not open the db '$dbname'");
- $test_query = "select * from Demonstration";
- $result = mysqli_query( $link, $test_query );
- while( $row = mysqli_fetch_array( $result, MYSQLI_ASSOC ) )
- {
- echo $row[ 'firstname' ], ' ', $row[ 'lastname' ], ' ',
- $row[ 'email' ], "<br />\n";
- }
- mysqli_free_result( $result );
- mysqli_close( $link );
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement