This block:
var $username="my_username";
var $servername="localhost";
var $database="my_DB";
var $password="An_Awesome_Password";
var $con;
It falls before function(), not inside; but still inside the definition class.
And this is a good form for adding explicit visibility; to start:
class database {
private $username="my_username";
private $servername="localhost";
Then the functions refer to them as:
$this->username;
$this->con;
etc.
Ideally, you want these credentials to be passed in by the constructor:
private $servername;
private $database;
private $username;
private $password;
private $con;
function __construct($host, $user, $password, $dbname)
{
$this->servername = $host;
$this->username = $user;
$this->password = $password;
$this->database = $dbname;
}
Better yet, learn about PDO