【问题标题】:phalcon phql fetch vs fetch allphalcon phql fetch vs fetch all
【发布时间】:2016-05-10 02:11:07
【问题描述】:

我在使用 PHQL 时得到一个 fetchAll。

是否可以将其设置为仅获取?

$result = $this->modelsManager->executeQuery ( $phql , [ "id" => $id ] );

我必须将结果设置为:return $result[0];

干杯。

【问题讨论】:

    标签: sql phalcon


    【解决方案1】:

    尝试:

    $phql = "SELECT * FROM \Models\News AS n WHERE n.id = :id:";
    $singleResult = $this->modelsManager->executeQuery($phql, ['id' => 3])->getFirst(); 
    

    【讨论】:

      猜你喜欢
      • 2016-08-06
      • 1970-01-01
      • 2014-03-31
      • 1970-01-01
      • 1970-01-01
      • 2015-10-06
      • 1970-01-01
      • 1970-01-01
      • 2022-06-14
      相关资源
      最近更新 更多