Jump to content

mopardude

Member
  • Posts

    5
  • Joined

  • Last visited

Everything posted by mopardude

  1. Out of curiosity is the only recorded that is posted that last record you inputed? From what you have posted here your variables that hold the field data is over writing each other because your using the same variables for each record.
  2. I moved this code out of the class it was in and it made no difference. I also tested it only using the 3 files like you and it didn't error out anymore. I have a script that scans the class dir and auto includes all the class files. So if that wasn't working correctly I would have way more than 1 class that wouldn't be working. When I manually add the includes for both classes it tells me I am redeclaring them. For what that its_Email class does at this point I can do what needs to be done other ways. File this problem away in the back of my head and come back to it when I better understand extending classes.
  3. Yea that code looks stupid because I was experimenting with a few ideas than I gutted it down from the original to troubleshoot my problem. Since your thinking was the same as mine about it being included properly or not got me thinking. So I went back and looked at the problem in a different way and I discovered I am calling that its_email class from inside another class. Could this be my problem? This is a slimmed down version of the method from the class that is calling its_Email. public function somefunction(){ $new_email = new its_Email(); $new_email->email_subject = $this->email_subject; $new_email->email_to_address = $this->email_address; $new_email->email_message = "msg to be sent"; $new_email->send_email(); }
  4. Ok here is the situation I have a basic class called email class Email{ public $email_subject; public $email_to_address; public $email_from_address; public $email_message; public function send_email(){ $this->mail($this->email_to_address, $this->email_subject, $this->email_message, $this->email_from_address); } } Works perfect by itself. Than when I try to extend it I get en error in the first line. class its_Email extends Email{ public $email_from_address = "From: Mopardude's Site<myemail@somedomain.com>"; public function __construct(){ $this->email_from_address = $email_from_address; } } Both classes are in the same class directory which are auto included by a script at startup. At first I thought the extend class was being instancitiated before email was included, but really that is not possible if both classes are included before the call to them is ever made right? The funny thing is I have a similar class that is extended the same way and that work perfectly. Any ideas what I did wrong here?
  5. I was watching Stefan's vids on beginning class progamming over at the killerphp.com site. I get what he means about keeping the view code seperate from the business logic when creating classes. So does that mean it would be frowned upon to create a class that filled in table data for example? I mean I realize it is possible to program this, but like he said it is possible non-coders might have to make changes to the page like css or whatever. What would be the right way to handle this situation?
×
×
  • Create New...