Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //1. Create a database connection
- $dbhost = "localhost";
- $dbuser = "root";
- $dbpass = "";
- $dbname = "db_abc";
- $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
- //Showing error in case of failed connection
- if(mysqli_connect_errno()){
- die(
- "Database connection failed: ".mysqli_connect_error()." (".mysqli_connect_errno().")"
- );
- }
- ?>
- <html>
- <head>
- <title>PHP MySQL Database</title>
- </head>
- <body>
- <?php
- $error = array();
- ?>
- </body>
- </html>
- <?php
- //Close database connection
- mysqli_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement