本文整理汇总了PHP中App\Http\Controllers\DB::query方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::query方法的具体用法?PHP DB::query怎么用?PHP DB::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\DB
的用法示例。
在下文中一共展示了DB::query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMatches
private function getMatches($MatchType)
{
\DB::$user = 'euro2016';
\DB::$password = 'hllau860509';
\DB::$dbName = 'Euro2016';
$results = \DB::query("\n\t\t\tselect A.MatchID, A.CountryHomeID, A.CountryAwayID, A.TimeAndDate, B.CountryName CountryHomeName, B.Flag CountryHomeFlag, \n\t\t\tC.CountryName CountryAwayName, C.Flag CountryAwayFlag, B.CountryGroup, D.CountryHome CountryHomeScore, D.CountryAway CountryAwayScore \n\t\t\tfrom Matches A\n\t\t\tjoin Countries B on B.CountryID = A.CountryHomeID\n\t\t\tjoin Countries C on C.CountryID = A.CountryAwayID\n\t\t\tleft join Scores D on D.MatchID = A.MatchID and D.UserID = %i\n\t\t\twhere A.MatchType = %s \n\t\t\t;", Auth::user()->id, $MatchType);
//where B.CountryGroup in ('A','B','C','D','E','F')
//where D.UserID = %i
$mArray = [];
foreach ($results as $row) {
$object = new MatchesModel();
$object->MatchID = $row['MatchID'];
$object->CountryHomeName = $row['CountryHomeName'];
$object->CountryAwayName = $row['CountryAwayName'];
$object->TimeAndDate = $row['TimeAndDate'];
$object->CountryHomeFlag = $row['CountryHomeFlag'];
$object->CountryAwayFlag = $row['CountryAwayFlag'];
$object->CountryHomeScore = $row['CountryHomeScore'];
// == '' ? ' ' : $row['CountryHomeScore'];
$object->CountryAwayScore = $row['CountryAwayScore'];
// == '' ? ' ' : $row['CountryAwayScore'];
$object->CountryHomeScoreLabel = 'CountryHomeScoreLabel' . $row['MatchID'];
// == '' ? ' ' : $row['CountryAwayScore'];
$object->CountryAwayScoreLabel = 'CountryAwayScoreLabel' . $row['MatchID'];
// == '' ? ' ' : $row['CountryAwayScore'];
$mArray[] = $object;
}
\DB::disconnect();
return $mArray;
}
示例2: CountryDropdown
private function CountryDropdown()
{
\DB::$user = 'euro2016';
\DB::$password = 'hllau860509';
\DB::$dbName = 'Euro2016';
$results = \DB::query("select CountryID, CountryName from Countries;");
/*
$results = \DB::query("select A.CountryID, A.CountryName, B.selected from Countries A
left join (
select X.CountryID, 'selected' selected from Countries X
join Matches Y on Y.CountryHomeID = X.CountryID
where Y.MatchID = %i
)B on B.CountryID = A.CountryID
;", $matchid);
*/
return $results;
}