Jump to content

Parse Error


Jessica

Recommended Posts

function send(){
   $time = time();
   $sql = "INSERT INTO mail(from, userTo, subject, message, sent) VALUES($this->from, $this->$to, '$this->subject', '$this->message', $time)";
   return dbExecute($sql);
}

 

Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING on line 57

57 is the $sql = line.

 

What am I missing?

Link to comment
https://forums.phpfreaks.com/topic/42023-parse-error/
Share on other sites

<?php
function send(){
   $time = time();
   $sql = "INSERT INTO mail(from, userTo, subject, message, sent) VALUES($this->from, $this->to, '$this->subject', '$this->message', $time)";
   return dbExecute($sql);
}
?>

 

Try that maybe that should work. Replace $this->$to with $this->to

 

--FrosT

Link to comment
https://forums.phpfreaks.com/topic/42023-parse-error/#findComment-203773
Share on other sites

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.