mworkman Posted November 9, 2010 Share Posted November 9, 2010 Here is my code: <?php class ScheduleRecord { private $month; private $day; private $year; private $hour; private $minute; private $type; private $employeeNumber; public function __construct($employeeNumber, $type, $month, $day, $year, $hour, $minute) { $this->employeeNumber = $employeeNumber; $this->type = $type; $this->month = $month; $this->day = $day; $this->year = $year; $this->hour = $hour; $this->minute = $minute; } public function getType() { return $this->type; } public function getEmployeeNumber() { return $this->employeeNumber; } public function getMonth() { return $this->month; } public function getDay() { return $this->day; } public function getYear() { return $this->year; } public function getHour() { return $this->hour; } public function getMinute() { return $this->minute; } public function getType() { return $this->type; } } $shcRec = new ScheduleRecord(3, "DayIn", 04, 04, 04, 04, 04); echo $shcRec ->getEmployeeNumber(); ?> error: The page cannot be displayed because an internal server error has occurred. the last line seems to be the problem. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/ Share on other sites More sharing options...
OldWest Posted November 9, 2010 Share Posted November 9, 2010 I assume you have a server that runs (and its properly compiled) php? Please give a bit more insight into what you are working with here. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132038 Share on other sites More sharing options...
btherl Posted November 9, 2010 Share Posted November 9, 2010 Try adding this to the top of your script: ini_set('display_errors', 1); It looks to me like you have a space after $schRec in that last line. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132039 Share on other sites More sharing options...
mworkman Posted November 9, 2010 Author Share Posted November 9, 2010 I have a working server and other php files are working. I just edit and save the code in eclipse and then view it with firefox. If it doesn't work I get an IIS error. Is there any way of doing it that gives more information about what is wrong? Now even if I comment out the last 2 lines(leaving just the class) it wont work. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132043 Share on other sites More sharing options...
OldWest Posted November 9, 2010 Share Posted November 9, 2010 I have a working server and other php files are working. I just edit and save the code in eclipse and then view it with firefox. If it doesn't work I get an IIS error. Is there any way of doing it that gives more information about what is wrong? Now even if I comment out the last 2 lines(leaving just the class) it wont work. See btherl's post.. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132052 Share on other sites More sharing options...
mworkman Posted November 9, 2010 Author Share Posted November 9, 2010 I got it fixed. For some reason it didn't like me using: public function getType() { return $this->type; } I change it to: public function getScheduleType() { return $this->type; } and it works. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132053 Share on other sites More sharing options...
OldWest Posted November 9, 2010 Share Posted November 9, 2010 That might have been caused by the fact you were also calling: public function getType() { return $this->type; } Two times in the same class. So if you delete one of them, it will probably work with your original naming conventions. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132055 Share on other sites More sharing options...
mworkman Posted November 9, 2010 Author Share Posted November 9, 2010 That might have been caused by the fact you were also calling: public function getType() { return $this->type; } Two times in the same class. So if you delete one of them, it will probably work with your original naming conventions. I didn't notice that. It was the problem. Quote Link to comment https://forums.phpfreaks.com/topic/218158-why-does-this-not-work/#findComment-1132057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.