Jump to content

why does this not work?


mworkman

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.