whamsicore
whamsicore

Reputation: 8700

Symfony Doctrine query returning not working, returning 1 and 11

$PDO = Doctrine_Manager::getInstance()->connection()->getDbh();
$PDO->prepare("
      //SQL Query Here
")->execute();

I was told that this will work for creating a custom Doctrine query in Symfony. Regardless of what I put inside the prepare statement I get a value of 1 returned. Print_r of the returned variable gives 11. How odd... what is going on?

Upvotes: 1

Views: 433

Answers (1)

Jakub Zalas
Jakub Zalas

Reputation: 36191

That's because execute() returns TRUE on success and FALSE on FAILURE: http://pl.php.net/manual/en/pdostatement.execute.php

You should use one of the fetch* methods to actually retrieve data: http://pl.php.net/manual/en/pdostatement.fetchall.php

Upvotes: 1

Related Questions