本文整理匯總了PHP中mysqli::get_warnings方法的典型用法代碼示例。如果您正苦於以下問題:PHP mysqli::get_warnings方法的具體用法?PHP mysqli::get_warnings怎麽用?PHP mysqli::get_warnings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mysqli
的用法示例。
在下文中一共展示了mysqli::get_warnings方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onRun
public function onRun($currentTick)
{
$cnt = count($this->getOwner()->getServer()->getOnlinePlayers());
$result = $this->mysql->query("SELECT unix_timestamp()-max(unix_timestamp(at))as m FROM players_cnt");
$row = $result->fetch_assoc();
$result->close();
$m = is_array($row) ? (int) $row["m"] : 0;
if ($m === 0 or $m > 570) {
$this->mysql->query("DELETE FROM players_cnt WHERE unix_timestamp()-unix_timestamp(at) > 604800");
$this->mysql->query("INSERT INTO players_cnt (connects,joins,cnt) VALUES ({$this->connects},{$this->joins},{$cnt})");
$this->connects = 0;
$this->joins = 0;
$warnings = $this->mysql->get_warnings();
if ($warnings instanceof \mysqli_warning) {
do {
echo $warnings->message;
} while ($warnings->next());
}
}
}
示例2: get_warning
/**
* returns a string of the warnings from mysqli
* @return <array> array of string listing the sql warnings
*/
public function get_warning()
{
$result = $this->conn->get_warnings();
$count = sizeof($result);
$returning = array();
for ($i=0; $i<$count; $i++)
{
$returning[$i] = "Warning $i: ".$result[$i]['errno'].
": ".$result[$i]['message']."\n";
}
return $returning;
}