我需要帮助。我需要使用理论1.2获得更新sql查询的结果
我在googled上搜索并找到了一种使用理论进行原生sql查询的方法。
$preparequerystring = "UPDATE mdw_reportes_operacion SET mmaplicado = 2.742495126705653 WHERE id = 5294;";
$con = Doctrine_Manager::getInstance()->connection();
$st = $con->executeUpdate($preparequerystring,array(false));
print_r($st);我想知道如何检索有关正在执行的查询的一些信息。我试过了
$result = $st->fetch(); 但是它返回一个500个内部服务器错误。
在执行更新查询时,检索有关查询的信息的正确方法是什么?
发布于 2012-05-05 08:35:57
为什么不使用原则上的违约更新而不是行sql呢?
$q = Doctrine_Query::create()
->update('MdwReportesOperacion')
->set('mmaplicado', '2.742495126705653')
->where('id = ?', array(5294));
$rows = $q->execute();
echo $rows;编辑:
我不知道如何从原始的原则查询中检索结果,但是仍然可以使用pdo查询:
// update the way you want to retrieve database information
$database = sfYaml::load(dirname(__FILE__).'/../config/databases.yml');
$param = $database['all']['doctrine']['param'];
$conn = new PDO($param['dsn'], $param['username'], $param['password']);
// and then perform the query and retrieve the result
$rows = $conn->exec("UPDATE mdw_reportes_operacion SET mmaplicado = 2.742495126705653 WHERE id = 5294;");
echo $rows;https://stackoverflow.com/questions/10456945
复制相似问题