dongyin8009 2012-05-14 15:51
浏览 21

推进创建查询中的多个变量

According to the api (http://trac.propelorm.org/wiki/Documentation/1.6/ModelCriteria) I was searching for something like that:

$param1 = 5;
$param2 = 3;

select id, name from testtable where ((sin(?) * (cos(?));

equal to

select id, name from testtable where ((sin($param1) * (cos($param2));

How can I do this with propel? I only found a way to bind only 1 variable at once.

(I don't want to do a "AND" I just want to bind more than 1 variable)

From the docs, this is for binding one variable:

<?php
// Finding all Books where title = 'War And Peace'
$books = BookQuery::create()
  ->where('Book.Title = ?', 'War And Peace')
  ->find();
?>
  • 写回答

1条回答 默认 最新

  • dpd20130 2012-05-14 16:08
    关注

    Well I guess Propel works like Doctrine for this point, did you try :

    $res = TestQuery::create()
      ->where('((sin(?) * (cos(?))', array($param1, $param2))
      ->find();
    

    Ps: the link for documentation is so old, use the new one: http://www.propelorm.org/reference/model-criteria.html

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度