gpt4 book ai didi

php - Laravel - 从表中选择所有内容以及先前 SELECT 的结果

转载 作者:行者123 更新时间:2023-11-29 12:26:30 24 4
gpt4 key购买 nike

我尝试在 Laravel 中执行以下查询,但在计算 DB 类和 Eloquent 类时遇到问题。我想做如下的事情..

$week = DB::select('从日历中选择周,其中年 = 2015 年,月 = 01,日 = 30');
$secondResult = DB::select("SELECT * FROM 日历,其中年份 = 2015 年,周 = $week");
return View::make('日历')->with('工作日',$secondResult);

最佳答案

试试这个..

$week = DB::select('SELECT week FROM calendar WHERE year = 2015 and month = 01 and day = 30');
foreach ($week as $weekvalue)
{
echo $weekname=$weekvalue->week;
}

$secondResult = DB::select("SELECT * FROM calendar WHERE year = 2015 and week = $weekname");
return View::make('calendar')->with('weekdays',$secondResult);

关于php - Laravel - 从表中选择所有内容以及先前 SELECT 的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28229689/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com