Mistake, you know…

A rather stupid situation, but I’m stuck on it.

mysql_query("insert into first (nazv ,text) values ({$pole},'{$text}')") or die (mysql_error());
  • $pole – field of type text
  • $text – field of type textarea

What’s wrong?

Answer 1, authority 100%

text is a reserved word like.

mysql_query("insert into `first` (`nazv` ,`text`) values ('{$pole}','{$text}');") or die (mysql_error());

Try this.


if (@$_POST['save']){
  if (!$text || !$pole) {
    echo ("  ");
    } else {
    mysql_query($q = 'INSERT INTO first (`nazv`,`text`) VALUES (\''.mysql_real_escape_string($pole).'\', \''.mysql_real_escape_string($pole).'\');') or die (mysql_error().'<br />Query: '.$q);