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


PHP base::checkcon方法代码示例

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


在下文中一共展示了base::checkcon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: selectMatches

 public function selectMatches($con)
 {
     base::checkcon($con, __FUNCTION__);
     $sql = "select matches.*, alliances.* from alliances\n                INNER JOIN matches\n                ON (matches.CompetitionID = " . $this->ID . " and \n                alliances.MatchID = matches.ID)\n                order by matches.Number, alliances.Color";
     // print $sql;
     $result = mysqli_query($con, $sql);
     if (!$result) {
         die('Error: ' . mysqli_error($con));
     }
     $matches = array();
     while ($row = mysqli_fetch_array($result)) {
         $match = new match();
         $match->Competition = this;
         $match->Time = $row['Time'];
         $match->Number = $row['Number'];
         $match->Round = $row['Round'];
         $match->ID = $row['MatchID'];
         $a1 = new alliance($row->Color == 'red');
         $a1->set($row);
         $row = mysqli_fetch_array($result);
         $a2 = new alliance($row->Color == 'red');
         $a2->set($row);
         if ($a1->Color == 'red') {
             $match->RedAlliance = $a1;
             $match->BlueAlliance = $a2;
         } else {
             $match->RedAlliance = $a2;
             $match->BlueAlliance = $a1;
         }
         array_push($matches, $match);
     }
     mysqli_free_result($result);
     return $matches;
 }
开发者ID:errorcodexero,项目名称:scouting,代码行数:34,代码来源:competition.php

示例2: select

 public static function select($con, $number)
 {
     base::checkcon($con, __FUNCTION__);
     if (!$con) {
         die('selectTeam error:  no connection.');
     }
     $query = "SELECT * FROM robots where TeamNumber = " . $number;
     // print "$query\n";
     $result = mysqli_query($con, $query);
     $row = mysqli_fetch_assoc($result);
     if (!$row) {
         return null;
     } else {
         return new robot($row);
     }
 }
开发者ID:errorcodexero,项目名称:scouting,代码行数:16,代码来源:robot.php

示例3: selectGames

 public function selectGames($con)
 {
     base::checkcon($con, __FUNCTION__);
     $sql = "select * from games where MatchID = " . $this->ID;
     $result = mysqli_query($con, $sql);
     if (!$result) {
         die('Error: ' . mysqli_error($con));
     }
     $games = array();
     while ($row = mysqli_fetch_assoc($result)) {
         $game = new game($row);
         array_push($games, $game);
     }
     mysqli_free_result($result);
     return $games;
 }
开发者ID:errorcodexero,项目名称:scouting,代码行数:16,代码来源:match.php

示例4: select

 public function select($con, $matchid, $teamnumber)
 {
     base::checkcon($con, __FUNCTION__);
     $sql = sprintf("select * from games where MatchID = %s and TeamNumber = %s", $matchid, $teamnumber);
     $result = mysqli_query($con, $sql);
     if (!$result) {
         die('Error: ' . mysqli_error($con));
     }
     $row = mysqli_fetch_assoc($result);
     mysqli_free_result($result);
     if (!$row) {
         return null;
     } else {
         $game = new game($row);
         return $game;
     }
 }
开发者ID:errorcodexero,项目名称:scouting,代码行数:17,代码来源:game.php


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