Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Version: v2.11, Version Date: June 2016, Author: Silvio Mc Gurk (smcgurk@stmartins.edu)
- class dbConn {
- public function connect() {
- # Database Name and Host
- $hostname = "localhost";
- $database = "formdatabase";
- $username = "root";
- $password = "root123";
- $dsn = "mysql:dbname=$database;host=$hostname";
- # Attempting connection with selected database
- $connect = new mysqli($hostname, $username, $password, $database);
- # Check status of connection fail on error
- if ($connect->connect_error) {
- echo “Error connecting to database”;
- }
- # Return the mysqli connection
- return $connect;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment