Wani
Wani

Reputation: 11

Yii - Fatal error: Cannot redeclare function

I have this function called checkCentre1() and I'm unable to open my web application due to below error appearing:

Fatal error: Cannot redeclare checkCentre1() (previously declared in C:\xampp\htdocs\scms2\protected\views\layouts\main.php:39) in C:\xampp\htdocs\scms2\protected\views\layouts\main.php on line 50

I did not declare checkCentre1() somewhere else. I have tried few solutions below but none is working:

My code is as below:

function checkCentre1($value){  //line 39
  $modelUser = AuthUsers::model()->findByPk($value);

  if($modelUser){
    if($modelUser->ref_user_type_idref_user_type == 1 || $modelUser->ref_user_type_idref_user_type == 2){
        return true;
    }else{
        return false;
    }
  } else 
  return false;
} //line 50

Does anybody has any other solution for this?

Upvotes: 1

Views: 628

Answers (0)

Related Questions