本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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;
}
}