Jump to content

php class error - Cannot re-assign $this


ideahoppers

Recommended Posts

I'm getting this error : Fatal error: Cannot re-assign $this in /home/i_up_size/iupsize.com/lib/pmsgs.php on line 18

 

 

Any help would be greatly appreciated!

 

Here's the code:

 

Class pmsgs {

public $parentconvo;

public $latest_msg;

 

function pmsgs() {

$this->parentconvo;

$this->latest_msg;

}

 

function pconvoInsert($duedate, $budget) {

$convoquery = "INSERT INTO pconvo (latest_msg, deadline, budget)

VALUES ('0', '$duedate', '$budget')";

 

mysql_query($convoquery) or die(mysql_error());

 

$this1->parentconvo = mysql_insert_id();

return $this1->parentconvo;

}

 

function pmsgInsert($this1->parentconvo, $title, $bd, $to, $from) {

$query = "INSERT INTO pmsg (parent_msg, parent_convo, date_sent, title, body, sent_to, sent_from)

VALUES ('0', '$this ->pconvo', NOW(), '$title', '$bd', '$to', '$from')";

 

mysql_query($query) or die(mysql_error());

 

$this ->latest_msg = mysql_insert_id();

return $this ->latest_msg;

}

}

Link to comment
https://forums.phpfreaks.com/topic/171298-php-class-error-cannot-re-assign-this/
Share on other sites

Sorry I was testing it with $this1 - just to see if it would make a difference.. the original code is actually:

 

Class pmsgs {

public $parentconvo;

public $latest_msg;

 

function pmsgs() {

$this->parentconvo;

$this->latest_msg;

}

 

function pconvoInsert($duedate, $budget) {

$convoquery = "INSERT INTO pconvo (latest_msg, deadline, budget)

VALUES ('0', '$duedate', '$budget')";

 

mysql_query($convoquery) or die(mysql_error());

 

$this->parentconvo = mysql_insert_id();

return $this->parentconvo;

}

 

function pmsgInsert($this->parentconvo, $title, $bd, $to, $from) {

$query = "INSERT INTO pmsg (parent_msg, parent_convo, date_sent, title, body, sent_to, sent_from)

VALUES ('0', '$this ->pconvo', NOW(), '$title', '$bd', '$to', '$from')";

 

mysql_query($query) or die(mysql_error());

 

$this ->latest_msg = mysql_insert_id();

return $this ->latest_msg;

}

}

Archived

This topic is now archived and is closed to further replies.

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