php-mysql-pdo: execute not working after prepare when inserting

Viewed 2823

I have following lines:

    $sql = "INSERT INTO news (title, content) VALUES :title, :content";
    $pre = $this->prepare($sql);
    $pre->bindValue(":title", "xxx");
    $pre->bindValue(":content", "yyy");
    $pre->execute();

I get no error, but the query is also not executed (i checked the query log).

I tried following changes desperately:

 $t="xxx" and $pre->bindValue(":title", $t); (the same also for y)
 $sql = "INSERT INTO `news` (`title`, `content`) VALUES :title, :content";
 $sql = "INSERT INTO `news` (`title`, `content`) VALUES ':title', ':content'";

Nothing changes. Funny thing is i get no response, no warning, no error just nothing. But the query is not executed.

I found similar posts but non of them solved my problem.

(about $this ... The code is in a class extended from PDO class.)

2 Answers
Related