当前位置: 首页>>代码示例>>PHP>>正文


PHP DB::user方法代码示例

本文整理汇总了PHP中App\Http\Controllers\DB::user方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::user方法的具体用法?PHP DB::user怎么用?PHP DB::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Http\Controllers\DB的用法示例。


在下文中一共展示了DB::user方法的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;
 }
开发者ID:hllau9,项目名称:Euro2016,代码行数:30,代码来源:GameController.php

示例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;
 }
开发者ID:hllau9,项目名称:Euro2016,代码行数:17,代码来源:AdminController.php


注:本文中的App\Http\Controllers\DB::user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。