Ejemplo n.º 1
0
function ilog($rank, $_log, $line = "-")
{
    global $log;
    if (!$log) {
        $log = new iLog(0, 'qst', iLOG_INFO);
        if ($log) {
            $log->start();
        }
        set_ilog(ifile_name(__FILE__));
    }
    if ($log) {
        $log->tag_line($line);
        $log->log($rank, $_log);
    }
}
Ejemplo n.º 2
0
function db_query($sql, &$select_result, $out_arg = NULL, &$out_value = NULL)
{
    $mysqli = new mysqli(_HOST_, _USER_, _PSW_, _DB_);
    if (mysqli_connect_errno()) {
        die_err("err_mysql_con", __LINE__, mb_convert_encoding(mysqli_connect_error(), 'utf-8', 'gb2312'), ifile_name(__FILE__));
        // 错误码:接连数据库失败
    }
    $mysqli->query("set names 'utf8'");
    //输出中文
    $mysqli->autocommit(FALSE);
    $arry = array();
    $result_arr = array();
    if ($mysqli->multi_query($sql)) {
        if ($result = $mysqli->store_result()) {
            while (!is_null($select_result) && ($row = $result->fetch_assoc())) {
                array_push($select_result, $row);
            }
            $result->close();
        }
        while ($mysqli->more_results() && $mysqli->next_result()) {
            $result = $mysqli->store_result();
        }
    } else {
        die_err("err_null_out", __LINE__, mysqli_error($mysqli), ifile_name(__FILE__));
    }
    $mysqli->commit();
    $num = count($out_arg);
    $i = 0;
    while ($i < $num) {
        $result2 = $mysqli->query("select " . $out_arg[$i] . " ;");
        if ($result2) {
            while ($row = $result2->fetch_assoc()) {
                $out_value = array_merge($out_value, $row);
            }
            $i++;
            $result2->close();
        } else {
            die_err("err_null_out", __LINE__, mysqli_error($mysqli), ifile_name(__FILE__));
        }
    }
    $mysqli->close();
}