i have got a little problem with redirect function, I have a controller function named "someview" and I also created a view file of the same name (someview.ctp) The controller function will do some stuff(query data from the model). it can be simply described as follows
function someview()
{
$result=$this->User->getdatafrommodel();
if(null!=$result)
{
//do something
}
else
{
$this->redirect('usernotexist');
}
}
function usernotexist()
{
$this->loadSkin();
}
I also created a page named "usernotexist.ctp" which I would like to display some information as to when the specified user doesn't exist in the database system. However, my previous function (someview) always execute "if" and "else" both after it is called. If I eliminate the "else" part in that function, it then works correctly for me; the page named "someview.ctp" is displayed. The $result value returned from the getdatafrommodel function is correct. Thank you for any help.