I am new developer in php. I'm writing below code a class and functions to connect to the database. but code was not working how to create class and function oops concept help me.

**code:**

```
class database {

#code
var $host = "localhost";
var $username ="root";
var $password ="";

var $dbase ="blue";
var $myconnect;

function connectTodata()
{
    $conn = mysql_connect($this->host, $this->username, $this->password);

    if(!$conn)
    {
        die("Cannot Connect to the datagase");
    }
    else
    {
        $his->myconnect = $conn;
        echo "Connect Established";
    }
    return $myconnect;

}
 function selectDatabase() // selecting the database.
{
    mysql_select_db($this->database);  //use php inbuild functions for select database

    if(mysql_error()) // if error occured display the error message
    {

        echo "Cannot find the database ".$this->database;

    }
     echo "Database selected..";       
}

function closeConnection() // close the connection
{
    mysql_close($this->myconn);

    echo "Connection closed";
   }
}

```