2011-01-22 35 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