I have been looking at this error for days and I do cannot not find the error.
I know it is not standard practice to place your log on info in the database. I would typically use an include. I will change when I get the error figured out.
The exact error is: Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/mjcrawle/class/database.class.php on line 27 Sorry unable to connect:
I have a comment //this is line 26 for the exact location of the error
My database file is...
<?php
// Database Class
class Database {
/* Attributes */
private $host = 'localhost';
private $database = 'xxxxxxxxxxxxxx';
private $username = 'xxxxxxxxxxx';
private $password = 'xxxxxxxxxx';
public $connection;
/*Connection functions*/
function __construct(){
$this->db_connect();
} //ends constructor
/*Destructor function*/
function __destruct() {
} //ends destructor
public function db_connect() {
/*Connection to the DB*/
$conn = mysqli_connect($this->host, $this->username, $this->password)
or die("Sorry unable to connect: " . mysqli_error()); //Connects to server
/This is line 26/
mysqli_select_db($conn, $this->database)
or die("Sorry unable to connect: " . mysqli_error()); //Connect to database
$this->connection = $conn;
}
/*Query the database*/
public function db_query($query){
$result = mysqli_query($this->connection, $query);
return $result;
}
} //End database class
?>
http://php.net/manual/en/mysqli.error.php
mysqli_error needs the link passed to it
mysqli_error($conn)
i believe