本文整理汇总了PHP中mysql::close方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::close方法的具体用法?PHP mysql::close怎么用?PHP mysql::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_message
function process_message($msg)
{
echo "\n############ 信息日志开始 ###############\n";
echo date('Y-m-d H:i:s') . "=====" . $msg->body;
echo "\n############ 信息日志结束 ###############\n";
//执行SQL语句
$db_config = C("DB_CONFIG");
$dbConn = new mysql();
$dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], '');
$dbConn->select_db($db_config["master1"][4]);
$sql = $msg->body;
$query = $dbConn->query($sql);
if (!$query) {
Log::write($sql, Log::ERR);
} else {
echo date('Y-m-d H:i:s') . '===== [ok] ', '=====', $sql, "\n";
//确认消费OK
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
}
$dbConn->close();
// Send a message with the string "quit" to cancel the consumer.
if ($msg->body === 'quit') {
$msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
}
}
示例2: loginAction
function loginAction($request)
{
include_once PATH . "/class/mysql.php";
$db = new mysql();
$whereArr = array("userName" => "admin");
$db->dbconnect();
$result = $db->getRow("user", $whereArr);
$db->close();
$status = 0;
$backArr = array();
$backArr["command"] = $request["command"];
$backArr["action"] = $request["action"];
$backArr["status"] = $status;
echo json_encode($backArr);
return json_encode($backArr);
}
示例3: dirname
* ============================================================================
* 版权所有: 骑士网络,并保留所有权利。
* 网站地址: http://www.74cms.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
*/
define('IN_QISHI', true);
$alias = "QS_hunter_jobsshow";
require_once dirname(__FILE__) . '/../include/common.inc.php';
if ($_PLUG['hunter']['p_install'] == 1) {
$link[0]['text'] = "返回首页";
$link[0]['href'] = $_CFG['site_dir'];
showmsg("管理员已关闭此模块!", 1, $link);
}
if ($mypage['caching'] > 0) {
$smarty->cache = true;
$smarty->cache_lifetime = $mypage['caching'];
} else {
$smarty->cache = false;
}
$cached_id = $alias . (isset($_GET['id']) ? "|" . intval($_GET['id']) % 100 . '|' . intval($_GET['id']) : '') . (isset($_GET['page']) ? "|p" . intval($_GET['page']) % 100 : '');
require_once QISHI_ROOT_PATH . 'include/mysql.class.php';
$db = new mysql($dbhost, $dbuser, $dbpass, $dbname);
unset($dbhost, $dbuser, $dbpass, $dbname);
$mypage['tpl'] = '../tpl_hunter/default/' . $mypage['tpl'];
$smarty->assign('user_tpl', '../tpl_hunter/');
$smarty->display($mypage['tpl'], $cached_id);
$db->close();
unset($smarty);
示例4: function
$channel->exchange_declare($exchange_name, 'fanout', false, false, false);
$channel->queue_declare($queue_name, false, false, false, false);
$channel->queue_bind($queue_name, $exchange_name);
echo ' [*] Waiting for logs. To exit press CTRL+C', "\n";
$callback = function ($msg) {
// global $dbConn;
//var_dump($dbConn);
//常连接MYSQL
$db_config = C("DB_CONFIG");
$dbConn = new mysql();
$dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], '');
$dbConn->select_db($db_config["master1"][4]);
//$con_stat = $dbConn->ping();
$sql = $msg->body;
//echo $sql;echo "\n\n";
$query = $dbConn->query(json_decode($sql));
if (!$query) {
//Log::write($con_stat.'---'.$sql, Log::ERR);
Log::write($sql, Log::ERR);
} else {
//echo ' [ok] ', $con_stat,'---', $sql, "\n";
echo ' [ok] ', '---', $sql, "\n";
}
$dbConn->close();
};
$channel->basic_consume($queue_name, '', false, true, false, false, $callback);
while (count($channel->callbacks)) {
$channel->wait();
}
$channel->close();
$connection->close();
示例5: array
$mysql->query('TRUNCATE TABLE `tba_records`');
$events = array();
foreach($tba->get_attendance(null,$conf['team']) as $attended){
$mysql->query("INSERT INTO `tba_attendance` VALUES ({$attended['attendanceid']}, {$attended['teamnumber']}, {$attended['eventid']});");
if(!in_array($attended['eventid'], $events)){
$events[] = $attended['eventid'];
}
}
foreach($events as $event){
$evnt = $tba->get_events($event, null, null);
$record = $tba->get_official_record($conf['team'],$evnt[0]['eventid'],null);
$mysql->query("INSERT INTO `tba_events` VALUES ('{$evnt[0]['eventid']}', '{$evnt[0]['name']}', '{$evnt[0]['year']}', '{$evnt[0]['week']}', '{$evnt[0]['location']}', '{$evnt[0]['official']}','{$evnt[0]['tba_link']}', '{$record[0]['win']}', '{$record[0]['loose']}', '{$record[0]['tie']}', '{$record[0]['string']}', '{$record[0]['sum']}');");
}
$matches = $tba->get_matches($conf['team']);
foreach($matches as $match){
$mysql->query("INSERT INTO `tba_matches` VALUES ('{$match['matchid']}', '{$match['eventid']}', '{$match['matchname']}', '{$match['complevel']}', '{$match['matchnumber']}', '{$match['red1']}', '{$match['red2']}', '{$match['red3']}', '{$match['blue1']}', '{$match['blue2']}', '{$match['blue3']}', '{$match['bluescore']}', '{$match['redscore']}', '{$match['tba_link']}', '{$match['video_url']}');");
}
foreach($conf['games'] as $year => $game){
$record = $tba->get_official_record($conf['team'],null,$year);
$mysql->query("INSERT INTO `tba_records` VALUES ('{$year}', '{$record[0]['win']}', '{$record[0]['lose']}', '{$record[0]['tie']}', '{$record[0]['string']}', '{$record[0]['sum']}');");
}
$mysql->close();
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "$time seconds, {$mysql->qcount} querries";
?>
示例6: SetFlux
function SetFlux($type, $col, $id, $valeur)
{
global $objSite;
// requête pour vérifier l'existence de la traduction
/*
$Xpath = "/EvalActiSem/Querys/Query[@fonction='ExeAjax-AddTrad-VerifExist']";
$Q = $objSite->XmlParam->GetElements($Xpath);
$where = str_replace("-id10eF-", $id10eF, $Q[0]->where);
$where = str_replace("-idIeml-", $idIeml, $where);
$sql = $Q[0]->select.$Q[0]->from.$where;
*/
$sql = "INSERT INTO ieml_flux (flux_ieml, flux_date) \r\n VALUES ('" . $type . $col . $id . $valeur . "',now())";
$db = new mysql($objSite->infos["SQL_HOST"], $objSite->infos["SQL_LOGIN"], $objSite->infos["SQL_PWD"], $objSite->infos["SQL_DB"], $dbOptions);
$db->connect();
$result = $db->query($sql);
$message = mysql_affected_rows() . " modifiée";
$db->close();
return $message;
}