I cant find where my mistake is.
$result= mysql_query(" INSERT INTO inbox ( messages, from, to, date, control_panel_id, title )
VALUES( '".$message."' , '".$this->sender."' , '".$this->recipient."', NOW() , '".$this->control_panel_id."' , '".$title."' )
") or die(mysql_error());
I get:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, to, date, control_panel_id, title ) VALUES( ' ' at line 1
What am I doing which is wrong?
fromis a reserved word in SQL. If that’s a column name, you always have to enclose it in backticks. (Or double quotes for ANSI mode).You could also write your mysql_query string less cumbersome by actually utilizing the double quotes:
(And contemporary PHP database interfaces would be even less effort, bla bla..)