This is really my first major project with OOP, I'm building a blog script. So my problem is an error that I am getting here is the error
and my code is here
Like I said, I'm relatively new to OOP, so go easy
Thanks a lot
Code:
Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in c:\server\htdocs\blog\blog.php on line 68
PHP Code:
<?php
class blog {
var $host;
var $password;
var $username;
var $database;
var $author;
var $email;
var $mood;
var $date;
var $entry;
function connect($host,$password,$username,$database)
{
$this->host = $host;
$this->password = $password;
$this->username = $username;
$this->databse = $database;
$link = mysql_connect($this->host,$this->username,$this->password) or die("Could not connect to MySQL database server");
mysql_select_db($this->database,$link) or die("Could not select database");
}
function insert($author,$email,$mood,$entry)
{
$this->author = $author;
$this->email = $email;
$this->mood = $mood;
$this->date = date("l,F j,Y @ G:i A");
$this->entry = $entry;
$result = "INSERT INTO `blog`(`id`,`author`,`email`,`mood`,`date`,`entry`) VALUES('NULL','{$this->author}','{$this->email}','{$this->mood}','{$this->date}','{$this->entry}')";
mysql_query($result);
}
function select()
{
$result = "SELECT id,author,email,mood,date,entry FROM blog ORDER BY id ASC";
$query = mysql_query($result,$link) or die(mysql_error());
if($query){
if(mysql_num_rows($query) == 0){
echo "No information in database!";
}
else{
while($row = mysql_fetch_assoc($query)){
$this->author = $row['author'];
$this->email = $row['email'];
$this->mood = $row['mood'];
$this->date = $row['date'];
$this->entry = $row['entry'];
}
}
}
}
$exe = new blog; /* Line 68 */
$exe->connect('localhost','root','rootpass','test');
$exe->insert('Stevie Peele','[email protected]','Happy','Just a test');
?>

Comment