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


PHP MYSQL::dbResult方法代码示例

本文整理汇总了PHP中MYSQL::dbResult方法的典型用法代码示例。如果您正苦于以下问题:PHP MYSQL::dbResult方法的具体用法?PHP MYSQL::dbResult怎么用?PHP MYSQL::dbResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MYSQL的用法示例。


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

示例1: lookup_path

/**
 * Dado um apelido, retornar a sua URL de sistema, se houver. 
 * Dado um sistema um retorno URL do seu alias, se tal pessoa existe. 
 * Caso contr�rio, retorna FALSE.
 *
 * @param $action
 * um dos seguintes valores:
 * - wipe: apaga um cache de apelidos.
 * - alias: retorna um apelido para dar ao URL do sistema de caminhos (se existir).
 * - source: retorna a URL do sistema para um apelido (se existir)
 * @param $path
 * O caminho para investigar o sistema de apelidos ou correspondentes URLs.
 * @param $path_language
 * Opcional codigo de linguagem para procurar um caminho nele. O padr�o � a linguagem
 * da p�gina.
 * se nenhum caminho for definido pela lingagem ent�o ser� buscado um caminho se a linguagem.
 *
 * @return
 * ou um caminho de sistema, um caminho do apelido, ou FALSE se nenhum caminho for encontrado.
 */
function lookup_path($action, $path = '', $path_language = '')
{
    global $language, $cfg;
    // $map é um array com a chave da linguagem, contendo arrays com os apelidos dos caminhos
    static $map = array(), $no_src = array(), $count = NULL;
    $path_language = $path_language ? $path_language : $language['language']->language;
    $mysql = new MYSQL($cfg);
    // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
    if (!isset($count)) {
        $sql = "SELECT COUNT(ID_PATH) FROM {url_alias}";
        $count = $mysql->dbResult($mysql->SqlSelect($sql));
    }
    if ($action == 'wipe') {
        $map = array();
        $no_src = array();
        $count = NULL;
    } elseif ($count > 0 && $path != '') {
        if ($action == 'alias') {
            if (isset($map[$path_language][$path])) {
                return $map[$path_language][$path];
            }
            // Obtenha o resultado mais adequado caindo para tr�s com alias sem linguagem
            $sql = "SELECT dst FROM {url_alias} WHERE src = '{$path}' AND language IN('{$path_language}', '') ORDER BY language DESC, ID_PATH DESC";
            $alias = $mysql->dbResult($mysql->SqlSelect($sql, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__));
            $map[$path_language][$path] = $alias;
            return $alias;
        } elseif ($action == 'source' && !isset($no_src[$path_language][$path])) {
            // procura no valor de  $path sem cachear $map
            $src = FALSE;
            if (!isset($map[$path_language]) || !($src = array_search($path, $map[$path_language]))) {
                // Obtenha o resultado mais adequado caindo para tr�s com alias sem linguagem
                $sql = "SELECT src FROM {url_alias} WHERE dst = '{$path}' AND language IN('{$path_language}', '') ORDER BY language DESC, ID_PATH DESC";
                $src = "";
                if ($src = $mysql->dbResult($mysql->SqlSelect($sql, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__))) {
                    $map[$path_language][$src] = $path;
                } else {
                    // We can't record anything into $map because we do not have a valid
                    // index and there is no need because we have not learned anything
                    // about any Drupal path. Thus cache to $no_src.
                    $no_src[$path_language][$path] = TRUE;
                }
            }
            return $src;
        }
    }
    return FALSE;
}
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:67,代码来源:fnc.Path.php

示例2: sess_count

/**
 * Counts how many users have sessions. Can count either anonymous sessions or authenticated sessions.
 *
 * @param int $timestamp
 *   A Unix timestamp representing a point of time in the past.
 *   The default is 0, which counts all existing sessions.
 * @param boolean $anonymous
 *   TRUE counts only anonymous users.
 *   FALSE counts only authenticated users.
 * @return  int
 *   The number of users with sessions.
 */
function sess_count($timestamp = 0, $anonymous = true)
{
    global $cfg;
    $mysql = new MYSQL($cfg);
    $query = $anonymous ? ' AND ID_USER = 0' : ' AND ID_USER > 0';
    return $mysql->dbResult($mysql->SqlSelect('SELECT COUNT(ID_SESSION) AS count FROM {sessions} WHERE timestamp >= %d' . $query, $timestamp));
}
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:19,代码来源:fnc.Session.php

示例3: getFilename

function getFilename($type, $name, $filename = NULL)
{
    global $cfg;
    static $files = array();
    $GLOBALS['files'] &= $files;
    $mysql = new MYSQL($cfg);
    if (!isset($files[$type])) {
        $files[$type] = array();
    }
    if (!empty($filename) && file_exists($filename)) {
        $files[$type][$name] = $filename;
    } elseif (isset($files[$type][$name])) {
        // nothing
    } elseif ($cfg['db_name'] && (($file = $mysql->dbResult($mysql->SqlSelect("SELECT filename FROM {system} WHERE name = '%s' AND type = '%s'", $name, $type))) && file_exists($file))) {
        $files[$type][$name] = $file;
    } else {
        // Fallback to searching the filesystem if the database connection is
        // not established or the requested file is not found.
        $dir = $type == 'theme_engine' ? 'themes/engines' : "{$type}s";
        $file = $type == 'theme_engine' ? "{$name}.engine" : "{$name}.{$type}";
        $config = SITE_MODULOS;
        foreach (array("{$config}{$dir}/{$file}", "{$config}{$dir}/{$name}/{$file}", "{$dir}/{$file}", "{$dir}/{$name}/{$file}") as $file) {
            if (file_exists($file)) {
                $files[$type][$name] = $file;
                break;
            }
        }
    }
    if (isset($files[$type][$name])) {
        return $files[$type][$name];
    }
}
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:32,代码来源:fnc.Globals.php

示例4: is_denied

 private function is_denied($type, $mask)
 {
     $mysql = new MYSQL($this);
     $sql = "SELECT 1 FROM {$this->cfg[db_prefix]}access WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = %d";
     return $mysql->dbResult($mysql->SqlSelect($mysql->db_query_range($sql, $type, $mask, 0, 0, 1), __FILE__, __LINE__)) && !$mysql->db_result($mysql->SqlSelect($mysql->db_query_range($sql, $type, $mask, 1, 0, 1), __FILE__, __LINE__));
 }
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:6,代码来源:lib.StartSite.php


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