【发布时间】:2015-01-23 01:54:20
【问题描述】:
在这里尝试检索需要 ID 和日期匹配的特定记录时遇到了困难,这是我的代码:
$testq= DB::table('attendances')->where('user_id', '=', $userinput && 'logon', '=', $newdate)->get();
【问题讨论】:
标签: php oop laravel-4 orm eloquent
在这里尝试检索需要 ID 和日期匹配的特定记录时遇到了困难,这是我的代码:
$testq= DB::table('attendances')->where('user_id', '=', $userinput && 'logon', '=', $newdate)->get();
【问题讨论】:
标签: php oop laravel-4 orm eloquent
在哪里再添加一个。
$testq= DB::table('attendances')
->where('user_id', '=', $userinput)
->where('logon', '=', $newdate)
->get();
http://laravel.com/api/4.2/Illuminate/Database/Eloquent/Builder.html#method_where
$this where(string $column, string $operator = null, 混合 $value = 空,字符串 $boolean = 'and')
在查询中添加一个基本的 where 子句。
【讨论】:
作为@sectus 答案的补充,您可能会喜欢这种语法:
$testq= DB::table('attendances')->whereUserId($userinput)
->whereLogon($newdate)
->get();
【讨论】: