Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (22 sloc) 517 Bytes
<?php
/**
* file: db.php
* purpose: connector
*/
$host = "localhost";
$password = "password";
$user = "root";
$database = "sakila";
// connect
$mysqli = new mysqli( $host, $user, $password, $database ); // creates the object
// if error
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; // if error messages
}
else {
// if connected
echo "Your're connected to the database via: "
. $mysqli->host_info
. "\n";
}
?>