Error in Else statement

can anybody tell me why I’m getting a syntax error in the Else line…

function add()	{
	if(!empty($this->data )){
		if($this->Post->save($this->data));{
			$this->Session->setFlash('The post was successfully added!');
			$this->redirected(array('action'=>'index'));
		} else {
			$this->Session->setFlash('The post was not saved, please try again.');
		}
	}
}

Thank you

remove “;”

On your code :
if($this->Post->save($this->data));{

And you must write without ; :
if($this->Post->save($this->data)){

Thank you!

Sponsor our Newsletter | Privacy Policy | Terms of Service