本文整理匯總了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;
}
}