2011-01-22 56 views
1
$PDO = Doctrine_Manager::getInstance()->connection()->getDbh(); 
$PDO->prepare(" 
     //SQL Query Here 
")->execute(); 

有人告訴我,這將用於在Symfony中創建自定義原則查詢。無論我在準備聲明中放入什麼,我都會返回1的值。返回的變量的Print_r給出11.有多奇怪......發生了什麼事情?Symfony原則查詢返回不起作用,返回1和11

回答

1

這是因爲執行()返回TRUE成功和失敗返回FALSE:http://pl.php.net/manual/en/pdostatement.execute.php

您應該使用一種fetch方法之一來實際檢索數據:http://pl.php.net/manual/en/pdostatement.fetchall.php

+0

的print_r(輸出)給了我「sfOutputEscaperArrayDecorator對象([count:private] => 0 [value:protected] => Array()[escapingMethod:protected] => esc_specialchars)「有什麼想法? – whamsicore 2011-01-22 09:05:00