narjis Posted February 26, 2011 Share Posted February 26, 2011 I am calling my class constructor with the following code class controller{ function _construct($name,$pass){ session_start(); get_model_class($name, $pass); echo "I\'m in controller"; } } function get_model_class($username, $password){ $my_model = new model(); $my_model->check_users($username,$password); } $username = $_POST['username']; $password = $_POST['password']; echo "in controller.php"; $newUser = new controller($username,$password); but it is not entering the constructor Link to comment https://forums.phpfreaks.com/topic/228891-calling-class-constructor/ Share on other sites More sharing options...
SaMike Posted February 26, 2011 Share Posted February 26, 2011 you need double _ function __construct(blahblah){ instead of function _construct(blahblah){ Link to comment https://forums.phpfreaks.com/topic/228891-calling-class-constructor/#findComment-1179897 Share on other sites More sharing options...
trq Posted February 26, 2011 Share Posted February 26, 2011 A construct start with __ not _ Link to comment https://forums.phpfreaks.com/topic/228891-calling-class-constructor/#findComment-1179898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.