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


PHP ADODB_mysqli::ErrorMsg方法代码示例

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


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

示例1: xenobeHunter

 public static function xenobeHunter(\PDO $pdo_db, \ADODB_mysqli $db, array $playerinfo, $xenobeisdead, array $langvars, Reg $tkireg)
 {
     $targetinfo = array();
     $rescount = $db->Execute("SELECT COUNT(*) AS num_players FROM {$db->prefix}ships WHERE ship_destroyed='N' AND email NOT LIKE '%@xenobe' AND ship_id > 1");
     \Tki\Db::LogDbErrors($pdo_db, $rescount, __LINE__, __FILE__);
     $rowcount = $rescount->fields;
     $topnum = min(10, $rowcount['num_players']);
     // If we have killed all the players in the game then stop here.
     if ($topnum < 1) {
         return;
     }
     $res = $db->SelectLimit("SELECT * FROM {$db->prefix}ships WHERE ship_destroyed='N' AND email NOT LIKE '%@xenobe' AND ship_id > 1 ORDER BY score DESC", $topnum);
     \Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__);
     // Choose a target from the top player list
     $i = 1;
     $targetnum = random_int(1, $topnum);
     while (!$res->EOF) {
         if ($i == $targetnum) {
             $targetinfo = $res->fields;
         }
         $i++;
         $res->MoveNext();
     }
     // Make sure we have a target
     if (!$targetinfo) {
         \Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_RAW, "Hunt Failed: No Target ");
         return;
     }
     // Jump to target sector
     $sectres = $db->Execute("SELECT sector_id, zone_id FROM {$db->prefix}universe WHERE sector_id = ?;", array($targetinfo['sector']));
     \Tki\Db::LogDbErrors($pdo_db, $sectres, __LINE__, __FILE__);
     $sectrow = $sectres->fields;
     $zoneres = $db->Execute("SELECT zone_id,allow_attack FROM {$db->prefix}zones WHERE zone_id = ?;", array($sectrow['zone_id']));
     \Tki\Db::LogDbErrors($pdo_db, $zoneres, __LINE__, __FILE__);
     $zonerow = $zoneres->fields;
     // Only travel there if we can attack in the target sector
     if ($zonerow['allow_attack'] == "Y") {
         $stamp = date("Y-m-d H:i:s");
         $move_result = $db->Execute("UPDATE {$db->prefix}ships SET last_login = ?, turns_used = turns_used + 1, sector = ? WHERE ship_id = ?", array($stamp, $targetinfo['sector'], $playerinfo['ship_id']));
         \Tki\Db::LogDbErrors($pdo_db, $move_result, __LINE__, __FILE__);
         \Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_RAW, "Xenobe used a wormhole to warp to sector {$targetinfo['sector']} where he is hunting player {$targetinfo['character_name']}.");
         if (!$move_result) {
             $error = $db->ErrorMsg();
             \Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_RAW, "Move failed with error: {$error} ");
             return;
         }
         // Check for sector defenses
         $i = 0;
         $all_sector_fighters = 0;
         $defenses = array();
         $sql = "SELECT * FROM ::prefix::sector_defense WHERE sector_id = :sector_id AND defense_type = 'F' ORDER BY quantity DESC";
         $stmt = $pdo_db->prepare($sql);
         $stmt->bindParam(':sector_id', $targetinfo['sector']);
         $stmt->execute();
         $defenses_present = $stmt->fetchAll(\PDO::FETCH_ASSOC);
         if ($defenses_present !== null) {
             foreach ($defenses_present as $tmp_defense) {
                 $defenses[$i] = $tmp_defense;
                 $all_sector_fighters += $defenses[$i]['quantity'];
                 $i++;
             }
         }
         $i = 0;
         $total_sector_mines = 0;
         $sql = "SELECT * FROM ::prefix::sector_defense WHERE sector_id = :sector_id AND defense_type = 'M'";
         $stmt = $pdo_db->prepare($sql);
         $stmt->bindParam(':sector_id', $targetinfo['sector']);
         $stmt->execute();
         $defenses_present = $stmt->fetchAll(\PDO::FETCH_ASSOC);
         if ($defenses_present !== null) {
             foreach ($defenses_present as $tmp_defense) {
                 $defenses[$i] = $tmp_defense;
                 $total_sector_mines += $defenses[$i]['quantity'];
                 $i++;
             }
         }
         if ($all_sector_fighters > 0 || $total_sector_mines > 0 || $all_sector_fighters > 0 && $total_sector_mines > 0) {
             // Attack sector defenses
             $targetlink = $targetinfo['sector'];
             self::xenobeToSecDef($pdo_db, $db, $langvars, $playerinfo, $targetlink, $tkireg);
         }
         if ($xenobeisdead > 0) {
             return;
             // Sector defenses killed the Xenobe
         }
         \Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_RAW, "Xenobe launching an attack on {$targetinfo['character_name']}.");
         // Attack the target
         if ($targetinfo['planet_id'] > 0) {
             self::xenobeToPlanet($pdo_db, $db, $targetinfo['planet_id'], $tkireg, $playerinfo, $langvars);
             // Yes, so move to that planet
         } else {
             self::xenobeToShip($pdo_db, $db, $targetinfo['ship_id'], $tkireg, $playerinfo, $langvars);
             // Not on a planet, so move to the ship
         }
     } else {
         \Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_RAW, "Xenobe hunt failed, target {$targetinfo['character_name']} was in a no attack zone (sector {$targetinfo['sector']}).");
     }
 }
开发者ID:thekabal,项目名称:tki,代码行数:98,代码来源:Xenobe.php


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