public static function getTournamentdetails($tournament_id) {
$currentdate = date("Y-m-d")."00:00:00";
$tournament_info = DB::table('tournaments as t')->select(
't.tournament_id',
't.title',
't.console_id',
't.game_id',
't.start_date',
't.bracket',
't.prize',
't.entry_fee',
't.rules',
DB::Raw('DATE_FORMAT(t.start_date,"%b %d") AS start'),
'consoles.console_name',
'games.game_name as game_name',
DB::raw('IF(start_date <= "'.$currentdate.'" , 1, 0) as iscurrentlyenrolling')
)
->leftjoin(
'consoles AS consoles',
'consoles.console_id',
'=',
't.console_id'
)
->leftjoin(
'games AS games',
'games.game_id',
'=',
't.game_id'
)
->where(
't.tournament_id',
$tournament_id
)
->get();
$tournament_info[0]->rules = nl2br($tournament_info[0]->rules);
///$result = json_decode(json_encode($tournament_info), true);
return $tournament_info;
}
我很困惑,特别是关于currentdate变量 - 是否将时间初始化为午夜?
答案 0 :(得分:0)
.container {
display:flex;
flex-direction: row;
.left {
flex-basis: 30%; /* This doesn't work */
/* max-width: 30%; */ /* This works */
.box {
height: 50px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.middle {
flex-basis: 50%;
}
.right {
flex-basis: 20%;
}
}
被指定为当前的年 - 月 - 日,午夜时。这些函数在数据库中查询所有活动的锦标赛并返回该数据。
答案 1 :(得分:0)
$currentdate = date("Y-m-d")."00:00:00";
将返回“2018-04-1000:00:00”。 MySql不了解这一天&amp;小时部分。请添加空格$currentdate = date("Y-m-d")." 00:00:00";
它将准确返回中午(“2018-04-10 00:00:00”)。