Before I ask about problem, I read the suggested link, but it didn't help me.
My problem is when I try to instance a class.
The error is:
Notice: Undefined variable: userCore in /Applications/MAMP/htdocs/proyecto_cice/app/web/controller/controllerFormUser.php on line 74
I know the meaning of this notice, so I use the function class_exists() and I give me true. I used this function, because my first idea was I make a mistake in the class, but it isn't the problem.
I declare this object in load.php file, because I need it in others files too.
I understand the error, but I don't find it. If you can help, I'll be grateful.
The code in the main file where I try instance the class:
<?php
require '../load.php';
function signup($form){
if( $form['pass']== $form['repass'] ){
$exists = $userCore->find_mail( filter_project_form() );
if($exists==''){
$isCorrect = ($userCore->insert_user( filter_project_form() ));
if($isCorrect){echo 'correct';}
}
else{
echo "The user exists now";
}
}
else{
echo 'The passwords must be identical';
}
}
?>
And the file 'load.php' contains:
<?php
//CONFIG
require 'config.php';
require 'constants.php';
//CORE
require 'core/ddbb.php';
require 'core/user.php';
</code>
//CLASS MODEL
require 'model/class_user.php';
//CONTROLLER
require 'controller/controllerUser.php';
//INSTANCIA
$userCore = new User_core();
And the file core/user.php is:
<?php
class User_core extends DDBB_core{
function find_mail($form){
$sql = "SELECT email FROM user WHERE email='".$form['mail']."'";
return $this->executeSelectQuery($sql);
}
}
Thanks