예제 #1
0
 private function getMatches($MatchType)
 {
     \DB::$user = '******';
     \DB::$password = '******';
     \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
0
 private function CountryDropdown()
 {
     \DB::$user = '******';
     \DB::$password = '******';
     \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;
 }