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


PHP dbFetch函数代码示例

本文整理汇总了PHP中dbFetch函数的典型用法代码示例。如果您正苦于以下问题:PHP dbFetch函数的具体用法?PHP dbFetch怎么用?PHP dbFetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: angkatan_name

function angkatan_name($a){
	if(is_array($a)) 
		$b=$a['angkatan'];
	else 
		$b=$a;
	return dbFetch("angkatan","aka_angkatan","W/replid='$b'");
}
开发者ID:nickohappy7,项目名称:sister,代码行数:7,代码来源:angkatan.php

示例2: setUser

function setUser($user_id_md5)
{
    global $user;
    global $cfg;
    global $season;
    unsetUser($user);
    $user_id_md5 = stripslashes($user_id_md5);
    list($id_user, $md5_password) = unserialize($user_id_md5);
    if ($id_user != "") {
        $users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}users` WHERE `id` = {$id_user}");
        if ($users_row = dbFetch($users_ref) and $md5_password == md5($users_row['password'])) {
            $user['uid'] = $users_row['id'];
            $user['username'] = $users_row['username'];
            if (!isset($season)) {
                $season_users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}season_users` " . "WHERE `id_user` = {$users_row['id']} AND `id_season` = 0");
            } else {
                $season_users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}season_users` " . "WHERE `id_user` = {$users_row['id']} AND (`id_season` = 0 OR `id_season` = {$season['id']})");
            }
            while ($season_users_row = dbFetch($season_users_ref)) {
                if ($season_users_row['usertype_root'] == 1) {
                    $user['usertype_root'] = $season_users_row['usertype_root'];
                }
                if ($season_users_row['usertype_headadmin'] == 1) {
                    $user['usertype_headadmin'] = $season_users_row['usertype_headadmin'];
                }
                if ($season_users_row['usertype_admin'] == 1) {
                    $user['usertype_admin'] = $season_users_row['usertype_admin'];
                }
                if ($season_users_row['usertype_player'] == 1) {
                    $user['usertype_player'] = $season_users_row['usertype_player'];
                }
            }
        }
    }
}
开发者ID:eb,项目名称:phptourney,代码行数:35,代码来源:user.inc.php

示例3: tahunajaran_name

function tahunajaran_name($a)
{
    if (is_array($a)) {
        $a = $a['tahunajaran'];
    }
    return dbFetch("tahunajaran", "aka_tahunajaran", "W/replid='{$a}'");
}
开发者ID:sofiasrifin,项目名称:sistermetta,代码行数:7,代码来源:tahunajaran.php

示例4: MstrGetReminder

function MstrGetReminder($a, $b)
{
    if (intval($b) == 0) {
        return 0;
    } else {
        return intval(dbFetch("reminder", "mstr_" . $a, "W/dcid='{$b}'"));
    }
}
开发者ID:epiii,项目名称:siadu-epiii,代码行数:8,代码来源:masterdb.php

示例5: departemen_name

function departemen_name($a)
{
    if (is_array($a)) {
        $b = $a['departemen'];
    } else {
        $b = $a;
    }
    return dbFetch("nama", "departemen", "W/replid='{$b}'");
}
开发者ID:epiii,项目名称:siadu-epiii,代码行数:9,代码来源:departemen.php

示例6: kategorirek_name

function kategorirek_name($a)
{
    if (is_array($a)) {
        $b = $a['kategorirek'];
    } else {
        $b = $a;
    }
    return dbFetch("nama", "keu_kategorirek", "W/replid='{$b}'");
}
开发者ID:epiii,项目名称:siadu-epiii,代码行数:9,代码来源:rekening.php

示例7: angkatan_name

function angkatan_name($a)
{
    if (is_array($a)) {
        $b = $a['angkatan'];
    } else {
        $b = $a;
    }
    return dbFetch("angkatan", "aka_angkatan", "W/replid='{$b}'");
}
开发者ID:sofiasrifin,项目名称:sistermetta,代码行数:9,代码来源:angkatan.php

示例8: groupList

 public function groupList($params = array())
 {
     $CI =& get_instance();
     extract($params);
     logConfig('altoDriver_group|action:list', 'logAlto');
     $sql = "select group_id, group_name, group_type, group_detail from gun_groups order by group_name asc";
     logConfig('altoDriver_group|sql:' . $sql, 'logAlto');
     $data0 = dbFetch($sql);
     //====clean
     $groups = array();
     foreach ($data0 as $arr) {
         $groups[] = dbCleanField($arr, 'group_');
     }
     $data = array('total' => $CI->group->total(), 'group' => $groups);
     return array('code' => 9, 'data' => $data);
 }
开发者ID:nmadipati,项目名称:secure,代码行数:16,代码来源:Altodriver_group.php

示例9: dbFetchAll

function dbFetchAll($id, $name)
{
    $data = array();
    $title = dbquery("SELECT * from titles left join templates on titles.template=templates.id where titles.id='{$id}'  ");
    $result = mysql_fetch_array($title);
    $templateXML = fopen($result["path"], "r");
    $contents = stream_get_contents($templateXML);
    $xml = new SimpleXMLElement($contents);
    foreach ($xml->geo->children() as $geo) {
        if ($geo["name"] == $name) {
            $data = dbFetch($id, $geo);
        }
    }
    foreach ($xml->overlay->children() as $geo) {
        if ($geo["name"] == $name) {
            $data = dbFetch($id, $geo);
        }
    }
    return $data;
}
开发者ID:hamilr2,项目名称:rpits,代码行数:20,代码来源:include.php

示例10: IN

    echo "-i <instances> -n <number>                   Poll as instance <number> of <instances>\n";
    echo "                                             Instances start at 0. 0-3 for -n 4\n\n";
    echo "\n";
    echo "Debugging and testing options:\n";
    echo "-d                                           Enable debugging output\n";
    echo "-m                                           Specify single module to be run\n";
    echo "\n";
    echo "Invalid arguments!\n";
    exit;
}
include "includes/sql-schema/update.php";
$discovered_devices = 0;
if ($config['distributed_poller'] === TRUE) {
    $where .= " AND poller_group IN(" . $config['distributed_poller_group'] . ")";
}
foreach (dbFetch("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 {$where} ORDER BY device_id DESC") as $device) {
    discover_device($device, $options);
}
$end = utime();
$run = $end - $start;
$proctime = substr($run, 0, 5);
if ($discovered_devices) {
    dbInsert(array('type' => 'discover', 'doing' => $doing, 'start' => $start, 'duration' => $proctime, 'devices' => $discovered_devices), 'perf_times');
}
$string = $argv[0] . " {$doing} " . date($config['dateformat']['compact']) . " - {$discovered_devices} devices discovered in {$proctime} secs";
if ($debug) {
    echo "{$string}\n";
}
if ($options['h'] != "new" && $config['version_check']) {
    include "includes/versioncheck.inc.php";
}
开发者ID:job,项目名称:librenms,代码行数:31,代码来源:discovery.php

示例11: app_form_gpost

function app_form_gpost()
{
    $s = array();
    $a = func_get_args();
    $n = count($a);
    for ($i = 0; $i < $n; $i++) {
        if ($a[$i] == 'photo') {
            // upload foto
            $id = gpost('photo');
            if ($id != '') {
                if (intval($id) != 0) {
                    $p = dbFetch("photo", "tmp_photo", "W/replid='{$id}'") . "'";
                    dbDel("tmp_photo", "replid='{$id}'");
                    $s['photo'] = $p;
                } else {
                    $s['photo'] = '';
                }
            }
        } else {
            //selain foto
            $s[$a[$i]] = gpost($a[$i]);
        }
    }
    return $s;
}
开发者ID:epiii,项目名称:siadu-epiii,代码行数:25,代码来源:common.php

示例12: dbFetchKeyValue

function dbFetchKeyValue($sql, $parameters = array(), $nocache = false)
{
    $data = array();
    foreach (dbFetch($sql, $parameters, $nocache) as $row) {
        $key = array_shift($row);
        if (sizeof($row) == 1) {
            // if there were only 2 fields in the result
            // use the second for the value
            $data[$key] = array_shift($row);
        } else {
            // if more than 2 fields were fetched
            // use the array of the rest as the value
            $data[$key] = $row;
        }
    }
    return $data;
}
开发者ID:jcbailey2,项目名称:librenms,代码行数:17,代码来源:dbFacile.mysqli.php

示例13: generate_query_permitted

if (isset($vars['format']) && preg_match("/^[a-z]*\$/", $vars['format'])) {
    #  $map = 'digraph G { bgcolor=transparent; splines=true; overlap=scale; concentrate=0; epsilon=0.001; rankdir=LR
    $map = 'digraph G { bgcolor=transparent; splines=true; overlap=scale; rankdir=LR
     node [ fontname="helvetica", fontstyle=bold, style=filled, color=white, fillcolor=lightgrey, overlap=false];
     edge [ bgcolor=white, fontname="helvetica", fontstyle=bold, arrowhead=dot, arrowtail=dot];
     graph [bgcolor=transparent;];

';
    if (!$_SESSION['authenticated']) {
        $map .= "\"没有经过身份验证\" [fontsize=20 fillcolor=\"lightblue\", URL=\"/\" shape=box3d]\n";
    } else {
        $loc_count = 1;
        $cache['where']['devices_permitted'] = generate_query_permitted(array('device'), array('device_table' => 'D'));
        foreach (dbFetch("SELECT D.*, COUNT(L.local_port_id) FROM devices AS D LEFT JOIN (ports AS I, links AS L) ON (D.device_id = I.device_id AND I.port_id = L.local_port_id) " . $where . $cache['where']['devices_permitted'] . " GROUP BY D.hostname ORDER BY COUNT(L.local_port_id) DESC") as $device) {
            if ($device) {
                $links = dbFetch("SELECT * from ports AS I, links AS L WHERE I.device_id = ? AND L.local_port_id = I.port_id ORDER BY L.remote_hostname", array($device['device_id']));
                if (count($links)) {
                    $ranktype = substr($device['hostname'], 0, 2);
                    $ranktype2 = substr($device['hostname'], 0, 3);
                    if (!strncmp($device['hostname'], "c", 1) && !strstr($device['hostname'], "kalooga")) {
                        $ranks[$ranktype][] = $device['hostname'];
                    } else {
                        $ranks[$ranktype2][] = $device['hostname'];
                    }
                    if ($anon) {
                        $device['hostname'] = md5($device['hostname']);
                    }
                    if (!isset($locations[$device['location']])) {
                        $locations[$device['location']] = $loc_count;
                        $loc_count++;
                    }
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:map.php

示例14: poll_device

function poll_device($device, $options)
{
    global $config, $device, $polled_devices, $db_stats, $memcache;
    $attribs = get_dev_attribs($device['device_id']);
    $status = 0;
    unset($array);
    $device_start = utime();
    // Start counting device poll time
    echo $device['hostname'] . ' ' . $device['device_id'] . ' ' . $device['os'] . ' ';
    if ($config['os'][$device['os']]['group']) {
        $device['os_group'] = $config['os'][$device['os']]['group'];
        echo '(' . $device['os_group'] . ')';
    }
    echo "\n";
    unset($poll_update);
    unset($poll_update_query);
    unset($poll_separator);
    $poll_update_array = array();
    $update_array = array();
    $host_rrd = $config['rrd_dir'] . '/' . $device['hostname'];
    if (!is_dir($host_rrd)) {
        mkdir($host_rrd);
        echo "Created directory : {$host_rrd}\n";
    }
    $address_family = snmpTransportToAddressFamily($device['transport']);
    $ping_response = isPingable($device['hostname'], $address_family, $attribs);
    $device_perf = $ping_response['db'];
    $device_perf['device_id'] = $device['device_id'];
    $device_perf['timestamp'] = array('NOW()');
    if (can_ping_device($attribs) === true && is_array($device_perf)) {
        dbInsert($device_perf, 'device_perf');
    }
    $device['pingable'] = $ping_response['result'];
    $ping_time = $ping_response['last_ping_timetaken'];
    $response = array();
    $status_reason = '';
    if ($device['pingable']) {
        $device['snmpable'] = isSNMPable($device);
        if ($device['snmpable']) {
            $status = '1';
            $response['status_reason'] = '';
        } else {
            echo 'SNMP Unreachable';
            $status = '0';
            $response['status_reason'] = 'snmp';
        }
    } else {
        echo 'Unpingable';
        $status = '0';
        $response['status_reason'] = 'icmp';
    }
    if ($device['status'] != $status) {
        $poll_update .= $poll_separator . "`status` = '{$status}'";
        $poll_separator = ', ';
        dbUpdate(array('status' => $status, 'status_reason' => $response['status_reason']), 'devices', 'device_id=?', array($device['device_id']));
        dbInsert(array('importance' => '0', 'device_id' => $device['device_id'], 'message' => 'Device is ' . ($status == '1' ? 'up' : 'down')), 'alerts');
        log_event('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device, $status == '1' ? 'up' : 'down');
    }
    if ($status == '1') {
        $graphs = array();
        $oldgraphs = array();
        if ($options['m']) {
            foreach (explode(',', $options['m']) as $module) {
                if (is_file('includes/polling/' . $module . '.inc.php')) {
                    include 'includes/polling/' . $module . '.inc.php';
                }
            }
        } else {
            foreach ($config['poller_modules'] as $module => $module_status) {
                if ($attribs['poll_' . $module] || $module_status && !isset($attribs['poll_' . $module])) {
                    // TODO per-module polling stats
                    include 'includes/polling/' . $module . '.inc.php';
                } else {
                    if (isset($attribs['poll_' . $module]) && $attribs['poll_' . $module] == '0') {
                        echo "Module [ {$module} ] disabled on host.\n";
                    } else {
                        echo "Module [ {$module} ] disabled globally.\n";
                    }
                }
            }
        }
        //end if
        if (!$options['m']) {
            // FIXME EVENTLOGGING -- MAKE IT SO WE DO THIS PER-MODULE?
            // This code cycles through the graphs already known in the database and the ones we've defined as being polled here
            // If there any don't match, they're added/deleted from the database.
            // Ideally we should hold graphs for xx days/weeks/polls so that we don't needlessly hide information.
            foreach (dbFetch('SELECT `graph` FROM `device_graphs` WHERE `device_id` = ?', array($device['device_id'])) as $graph) {
                if (isset($graphs[$graph['graph']])) {
                    $oldgraphs[$graph['graph']] = true;
                } else {
                    dbDelete('device_graphs', '`device_id` = ? AND `graph` = ?', array($device['device_id'], $graph['graph']));
                }
            }
            foreach ($graphs as $graph => $value) {
                if (!isset($oldgraphs[$graph])) {
                    echo '+';
                    dbInsert(array('device_id' => $device['device_id'], 'graph' => $graph), 'device_graphs');
                }
                echo $graph . ' ';
//.........这里部分代码省略.........
开发者ID:jcbailey2,项目名称:librenms,代码行数:101,代码来源:functions.inc.php

示例15: print_message

}
if (!$where) {
    print_message("%n\nUSAGE:\n{$scriptname} [-drqV] [-i instances] [-n number] [-m module] [-h device]\n\nEXAMPLE:\n-h <device id> | <device hostname wildcard>  Poll single device\n-h odd                                       Poll odd numbered devices  (same as -i 2 -n 0)\n-h even                                      Poll even numbered devices (same as -i 2 -n 1)\n-h all                                       Poll all devices\n-h new                                       Poll all devices that have not had a discovery run before\n\n-i <instances> -n <id/number>                Poll as instance <id/number> of <instances>\n                                             Instance numbers start at 0. 0-3 for -i 4\n                                             Example:\n                                               -i 4 -n 0\n                                               -i 4 -n 1\n                                               -i 4 -n 2\n                                               -i 4 -n 3\n\nOPTIONS:\n -h                                          Device hostname, id or key odd/even/all/new.\n -i                                          Poll instances count.\n -n                                          Instance id (number), must start from 0 and to be less than instances count.\n -q                                          Quiet output.\n -M                                          Show globally enabled/disabled modules and exit.\n -V                                          Show version and exit.\n\nDEBUGGING OPTIONS:\n -r                                          Do not create or update RRDs\n -d                                          Enable debugging output.\n -dd                                         More verbose debugging output.\n -m                                          Specify module(s) (separated by commas) to be run.\n\n%rInvalid arguments!%n", 'color', FALSE);
    exit;
}
if (isset($options['r'])) {
    $config['norrd'] = TRUE;
}
$cache['maint'] = cache_alert_maintenance();
rrdtool_pipe_open($rrd_process, $rrd_pipes);
print_cli_heading("%WStarting polling run at " . date("Y-m-d H:i:s"), 0);
$polled_devices = 0;
if (!isset($query)) {
    $query = "SELECT `device_id` FROM `devices` WHERE `disabled` = 0 {$where} ORDER BY `device_id` ASC";
}
foreach (dbFetch($query, $params) as $device) {
    $device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id']));
    poll_device($device, $options);
    $polled_devices++;
}
$poller_end = utime();
$poller_run = $poller_end - $poller_start;
$poller_time = substr($poller_run, 0, 5);
if ($polled_devices) {
    dbInsert(array('type' => 'poll', 'doing' => $doing, 'start' => $poller_start, 'duration' => $poller_time, 'devices' => $polled_devices), 'perf_times');
    if (is_numeric($doing)) {
        $doing = $device['hostname'];
    }
    // Single device ID convert to hostname for log
} else {
    print_warning("WARNING: 0 devices polled. Did you specify a device that does not exist?");
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:poller.php


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