【问题标题】:How to carry out the 'and' operation in laravel 4.1 with multiple parameters如何在 laravel 4.1 中使用多个参数进行“与”操作
【发布时间】:2014-06-02 20:18:57
【问题描述】:

我想知道如何在 laravel 中编写以下内容:

SELECT * FROM items WHERE item_id = $id AND item_category = $cat AND item_price = $price;

$id、$cat 和 $price 动态传递给查询。 谢谢。

【问题讨论】:

    标签: php orm laravel laravel-4


    【解决方案1】:

    口才

    Item::where('item_id', $id)
    ->where('item_category', $cat)
    ->where('item_price', $price)
    ->get();
    

    流利

    DB::table('items')
    ->where('item_id', $id)
    ->where('item_category', $cat)
    ->where('item_price', $price)
    ->get();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-29
      • 2011-02-03
      相关资源
      最近更新 更多