ideahoppers Posted August 21, 2009 Share Posted August 21, 2009 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; } } Quote Link to comment https://forums.phpfreaks.com/topic/171298-php-class-error-cannot-re-assign-this/ Share on other sites More sharing options...
ignace Posted August 21, 2009 Share Posted August 21, 2009 $this1 must be $this Quote Link to comment https://forums.phpfreaks.com/topic/171298-php-class-error-cannot-re-assign-this/#findComment-903353 Share on other sites More sharing options...
ideahoppers Posted August 21, 2009 Author Share Posted August 21, 2009 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; } } Quote Link to comment https://forums.phpfreaks.com/topic/171298-php-class-error-cannot-re-assign-this/#findComment-903360 Share on other sites More sharing options...
Daniel0 Posted August 21, 2009 Share Posted August 21, 2009 function pmsgInsert($this->parentconvo, $title, $bd, $to, $from) { Red part isn't allowed. You cannot do that. Quote Link to comment https://forums.phpfreaks.com/topic/171298-php-class-error-cannot-re-assign-this/#findComment-903375 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.