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


PHP dbFetchRow函数代码示例

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


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

示例1: get_entity_by_id_cache

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage functions
 * @author     Adam Armstrong <adama@memetic.org>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
function get_entity_by_id_cache($type, $id)
{
    global $cache;
    if ($type !== 'port') {
        list($entity_table, $entity_id_field, $entity_name_field) = entity_type_translate($type);
    }
    if (is_array($cache[$type][$id])) {
        return $cache[$type][$id];
    } else {
        switch ($type) {
            case "port":
                $entity = get_port_by_id($id);
                break;
            default:
                $entity = dbFetchRow("SELECT * FROM `" . $entity_table . "` WHERE `" . $entity_id_field . "` = ?", array($id));
                if (function_exists('humanize_' . $type)) {
                    $do = 'humanize_' . $type;
                    $do($entity);
                }
                break;
        }
        if (is_array($entity)) {
            entity_rewrite($type, $entity);
            $cache[$type][$id] = $entity;
            return $entity;
        }
    }
    return FALSE;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:40,代码来源:entities.inc.php

示例2: get_entity_by_id_cache

function get_entity_by_id_cache($entity_type, $entity_id)
{
    global $cache;
    $translate = entity_type_translate_array($entity_type);
    if (is_array($cache[$entity_type][$entity_id])) {
        return $cache[$entity_type][$entity_id];
    } else {
        switch ($entity_type) {
            case "port":
                $entity = get_port_by_id($entity_id);
                break;
            default:
                $entity = dbFetchRow("SELECT * FROM `" . $translate['table'] . "` WHERE `" . $translate['id_field'] . "` = ?", array($entity_id));
                if (function_exists('humanize_' . $entity_type)) {
                    $do = 'humanize_' . $entity_type;
                    $do($entity);
                } elseif (isset($translate['humanize_function']) && function_exists('humanize_' . $translate['humanize_function'])) {
                    $do = 'humanize_' . $translate['humanize_function'];
                    $do($entity);
                }
                break;
        }
        if (is_array($entity)) {
            entity_rewrite($entity_type, $entity);
            $cache[$entity_type][$entity_id] = $entity;
            return $entity;
        }
    }
    return FALSE;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:30,代码来源:entities.inc.php

示例3: proxmox_vm_info

/**
 * Fetch all info about a Proxmox VM
 * @param integer $vmid Proxmox VM ID
 * @param string $c Clustername
 * @return array An array with all info of this VM on this cluster, including ports
 */
function proxmox_vm_info($vmid, $c)
{
    $vm = dbFetchRow("SELECT pm.*, d.hostname AS host, d.device_id FROM proxmox pm, devices d WHERE pm.device_id = d.device_id AND pm.vmid = ? AND pm.cluster = ?", array($vmid, $c));
    $appid = dbFetchRow("SELECT app_id FROM applications WHERE device_id = ? AND app_type = ?", array($vm['device_id'], 'proxmox'));
    $vm['ports'] = dbFetchRows("SELECT * FROM proxmox_ports WHERE vm_id = ?", array($vm['id']));
    $vm['app_id'] = $appid['app_id'];
    return $vm;
}
开发者ID:samyscoub,项目名称:librenms,代码行数:14,代码来源:proxmox.inc.php

示例4: get_customoid_by_id

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package        observium
 * @subpackage     functions
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
function get_customoid_by_id($oid_id)
{
    if (is_numeric($oid_id)) {
        $oid = dbFetchRow('SELECT * FROM `oids` WHERE `oid_id` = ?', array($oid_id));
    }
    if (count($oid)) {
        return $oid;
    } else {
        return FALSE;
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:21,代码来源:generic.inc.php

示例5: proxmox_vm_exists

/**
 * Check if a Proxmox VM exists
 * @param integer $i VM ID
 * @param string  $c Clustername
 * @param array   $pmxcache Reference to the Proxmox VM Cache
 * @return boolean true if the VM exists, false if it doesn't
 */
function proxmox_vm_exists($i, $c, &$pmxcache)
{
    if (isset($pmxcache[$c][$i]) && $pmxcache[$c][$i] > 0) {
        return true;
    }
    if ($row = dbFetchRow("SELECT id FROM proxmox WHERE vmid = ? AND cluster = ?", array($i, $c))) {
        $pmxcache[$c][$i] = (int) $row['id'];
        return true;
    }
    return false;
}
开发者ID:samyscoub,项目名称:librenms,代码行数:18,代码来源:proxmox.inc.php

示例6: get_alert_test_by_id

function get_alert_test_by_id($alert_test_id)
{
    if (is_numeric($alert_test_id)) {
        $alert_test = dbFetchRow('SELECT * FROM `alert_tests` WHERE `alert_test_id` = ?', array($alert_test_id));
    }
    if (is_array($alert_test) && count($alert_test)) {
        return $alert_test;
    } else {
        return FALSE;
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:11,代码来源:alerts.inc.php

示例7: get_port_stats_by_port_hostname

function get_port_stats_by_port_hostname()
{
    // This will return port stats based on a devices hostname and ifName
    global $config;
    $app = \Slim\Slim::getInstance();
    $router = $app->router()->getCurrentRoute()->getParams();
    $ifName = urldecode($router['ifname']);
    $stats = dbFetchRow("SELECT * FROM `ports` WHERE `ifName`=?", array($ifName));
    $output = array("status" => "ok", "port" => $stats);
    $app->response->headers->set('Content-Type', 'application/json');
    echo _json_encode($output);
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:12,代码来源:api_functions.inc.php

示例8: super_query

function super_query($q, $m = false)
{
    $q = query($q);
    global $qNum;
    $qNum++;
    if (!$m) {
        return dbFetchRow($q);
    }
    $r = array();
    while ($e = dbFetchRow($q)) {
        $r[] = $e;
    }
    return $r;
}
开发者ID:OTTO11,项目名称:db,代码行数:14,代码来源:db.php

示例9: getOrderAmount

function getOrderAmount($orderId)
{
    $orderAmount = 0;
    $sql = "SELECT SUM(pd_price * od_qty)\r\n\t        FROM tbl_order_item oi, tbl_product p \r\n\t\t    WHERE oi.pd_id = p.pd_id and oi.od_id = {$orderId}\r\n\t\t\t\r\n\t\t\tUNION\r\n\t\t\t\r\n\t\t\tSELECT od_shipping_cost \r\n\t\t\tFROM tbl_order\r\n\t\t\tWHERE od_id = {$orderId}";
    $result = dbQuery($sql);
    if (dbNumRows($result) == 2) {
        $row = dbFetchRow($result);
        $totalPurchase = $row[0];
        $row = dbFetchRow($result);
        $shippingCost = $row[0];
        $orderAmount = $totalPurchase + $shippingCost;
    }
    return $orderAmount;
}
开发者ID:jaherulalom,项目名称:SHOP-1-,代码行数:14,代码来源:checkout-functions.php

示例10: cas_authenticate

/**
 * Check username against CAS authentication backend. User needs to exist in MySQL to be able to log in.
 *
 * @param string $username User name to check
 * @param string $password User password to check
 * @return int Authentication success (0 = fail, 1 = success) FIXME bool
 */
function cas_authenticate($username, $password)
{
    $row = dbFetchRow("SELECT `username`, `password` FROM `users` WHERE `username`= ?", array($username));
    if ($row['username'] && $row['username'] == $username) {
        if ($username == phpCAS::getUser()) {
            return 1;
        }
        dbInsert(array('user' => $_SESSION['username'], 'address' => $_SERVER["REMOTE_ADDR"], 'result' => 'CAS: username does not match CAS user'), 'authlog');
    } else {
        dbInsert(array('user' => $_SESSION['username'], 'address' => $_SERVER["REMOTE_ADDR"], 'result' => 'CAS: NOT found in DB'), 'authlog');
    }
    //session_logout();
    return 0;
}
开发者ID:Natolumin,项目名称:observium,代码行数:21,代码来源:cas.inc.php

示例11: get_port_stats_by_port_hostname

function get_port_stats_by_port_hostname()
{
    // This will return port stats based on a devices hostname and ifName
    global $config;
    $app = \Slim\Slim::getInstance();
    $router = $app->router()->getCurrentRoute()->getParams();
    $hostname = $router['hostname'];
    $device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
    $ifName = urldecode($router['ifname']);
    $stats = dbFetchRow('SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=?', array($device_id, $ifName));
    $output = array('status' => 'ok', 'port' => $stats);
    $app->response->headers->set('Content-Type', 'application/json');
    echo _json_encode($output);
}
开发者ID:RobsanInc,项目名称:librenms,代码行数:14,代码来源:api_functions.inc.php

示例12: authenticate

function authenticate($username, $password)
{
    global $config;
    if (isset($_SERVER['REMOTE_USER'])) {
        $_SESSION['username'] = mres($_SERVER['REMOTE_USER']);
        $row = @dbFetchRow("SELECT username FROM `users` WHERE `username`=?", array($_SESSION['username']));
        if (isset($row['username']) && $row['username'] == $_SESSION['username']) {
            return 1;
        } else {
            $_SESSION['username'] = $config['http_auth_guest'];
            return 1;
        }
    }
    return 0;
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:15,代码来源:http-auth.inc.php

示例13: api_bill_permitted

/**
 * Check user permission to access the bill
 *
 * @return boolean
 * @param  bill_id
 *
*/
function api_bill_permitted($bill_id)
{
    global $vars;
    $res = false;
    if ($vars['user']['level'] >= 10) {
        $res = true;
    } else {
        api_show_debug("Checking permission for bill", $bill_id);
        $row = dbFetchRow("SELECT * FROM `entity_permissions` WHERE `entity_type` = 'bill' AND `user_id` = ? AND `entity_id`= ? LIMIT 1", array($vars['user']['id'], $bill_id));
        if (is_array($row)) {
            $res = true;
        }
    }
    api_show_debug("Returned bill permitted", $res);
    return $res;
}
开发者ID:skive,项目名称:observium,代码行数:23,代码来源:module.billing.inc.php

示例14: getComponentType

 public function getComponentType($TYPE = null)
 {
     if (is_null($TYPE)) {
         $SQL = "SELECT DISTINCT `type` as `name` FROM `component` ORDER BY `name`";
         $row = dbFetchRow($SQL, array());
     } else {
         $SQL = "SELECT DISTINCT `type` as `name` FROM `component` WHERE `type` = ? ORDER BY `name`";
         $row = dbFetchRow($SQL, array($TYPE));
     }
     if (!isset($row)) {
         // We didn't find any component types
         return false;
     } else {
         // We found some..
         return $row;
     }
 }
开发者ID:greggcz,项目名称:librenms,代码行数:17,代码来源:component.php

示例15: mysql_query

function mysql_query($query, $multi = false){
	global $inited_mysql, $mysql_iid;

	if(!$inited_mysql){
		new_db_decl();
		dbQuery("SET NAMES 'utf8'");
		$inited_mysql = true;
	}

	$db = dbQuery($query);

	$mysql_iid = dbInsertedId();

	if($multi){
		$data = array();
		while ($row = dbFetchRow($db)) $data[] = $row;
		return $data;
	}else return dbFetchRow($db);
}
开发者ID:221V,项目名称:fastchat_kphp,代码行数:19,代码来源:mysql.php


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