I'm having mucho problems, for some reason, i'm setting a property at the time of creation, and when i ask php to print it out i get a 500 Internal Server Error. Here is my code:
authenticate.php
<?php
include "templates/header.php";
include "classes/class_database.php";
$database = new database(); //create a new instance of the database class
print $database->$_host;
include "templates/footer.php";
?>
classes/class_database.php
<?php
class database
{
private $_link;
var $_host = "localhost"; //mysql host, most likely localhost
var $_username = "user"; //database username
var $_password = "pass"; //database password
var $_name = "mbecerra_pwnd"; //database name
public function connect()
{
$_link = mysql_connect($this->_host, $this->_name, $this->_username, $this->_password) or die("Failed to connect to the database server");
}
}
?>
Additionally when i uncomment:
print $database->$_host;
Everything works fine again. Any help would be appreciated.
Sincerely,
Open Source Pong
EDIT: Nevermind, i just noticed i had an extra $ where it wasn't supposed to.