so i have a class created for handling sql select and connection stuff. when i create an instance of the class in my index page it throws an error
heres the db class code
include "includes/config.php";
class database {
protected static $connection; // variable to hold the mysqli connection
protected function connect(){
if (!isset(self::$connection)){ // if the connection variable is not set
self::$connection = new mysqli(SERVER_NAME, USERNAME, PASSWORD, DB_NAME); // set the connection
}
if (self::$connection === false){ //in case connection failed return false
return false;
}
else {
return self::$connection; // returns the connection
}
}
protected function query($query){ // public function to take a sql query
$connection = $this->connect(); // calls the connect function to create a connection to the database
$result = $connection->query($query); // puts the query into the result variable
return $result; //returns the result
}
public function select($query){
$rows = array();
$result = $this->query($query);
if($result === false){
return false;
}
while($row = $result->fetch_assoc()){
$rows[] = $row;
}
return $rows;
}
public function error(){
$connection = $this->connect();
return $connection->error;
}
}
?>
there error is from the index page on line 7 when i try to create a class instance
<?php
include 'view/header.php';
include 'includes/connect.php';
include 'inckudes/config.php'
$db = new database();
$sql = "SELECT `first_name`, `last_name` FROM `pratts_db`
WHERE `first_name` = `clive`;"
$result = $db->select($sql);
if (sizeof($result) >= 1){
echo "query successful";
}
include 'view/footer.php';
?>
the exact error is as follows
Parse error: syntax error, unexpected '$db' (T_VARIABLE) in C:\wamp64\www\final\index.php on line 7