01-02-2008, 08:56 PM
|
#5 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
|
Same problem again!
I've got 2 classes.
email.class.php
mysql.class.php
In mySQL class, I've got an error report to be send to an email address using the email class. So, normally in the source I would define $mail->sendQueryError(); but it doesn't work. Now i've got $mail = new EmailClass; and later on $mail->sendQueryError. So, $this-> doesn't work, and it doesn't get the headers since a function for retrieving those is already defined in the email.class.
The drawHeaders function in email.class.php
PHP Code:
function drawHeaders($reciever, $additionalHeaders = '') { foreach (emailHeaders($reciever) as $headerKey => $headerValue) { if (empty($headers)) { $headers = $subheaderValue; } else { $headers = $headers.$subheaderValue; } } if ($additionalHeaders) { foreach ($additionalHeaders as $subheaderKey => $subheaderValue) { if (empty($subheaders)) { $subheaders = $subheaderValue; } else { $subheaders = $subheaders.$subheaderValue; } } } return ($headers.$subheaders); }
Part of the sendQueryError function inemail.class.php
PHP Code:
if (!empty($this->message)) { mail( $this->reciever, $this->subject, $this->message, $this->drawHeaders($this->reciever, $this->addheaders), $this->addparameters ); }
Part of the mySQLQuery function in mysql.class.php
PHP Code:
if (!$this->queryResult) { $errorMessage = "<b>MySQL Retourneerde een Error.</b><br>"; $errorMessage .= "<b>Error:</b> ".mysql_error()."<br>"; $errorMessage .= "<b>Lijn:</b> ".$getLine."<br>"; $errorMessage .= "<b>Bestand:</b> ".$getFile; $mail = new suRealityEmail; $mail->sendQueryError($errorMessage); $this->queryFailed++; }
And so, defined in index.php
PHP Code:
require_once('includes/classes/mysql.class.php'); require_once('includes/classes/email.class.php');
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|