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


PHP db_fetch_all函数代码示例

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


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

示例1: done

    function done()
    {
        $this->tpl->add('index', db_fetch_all('
			SELECT * FROM ' . db_escape($this->table) . '
			WHERE is_closed = 1
			ORDER BY date_closed
		'));
    }
开发者ID:anatoliychakkaev,项目名称:webdesk,代码行数:8,代码来源:todos.php

示例2: cheatsheets

    function cheatsheets()
    {
        $this->tpl->add('cheatsheets', db_fetch_all('
			SELECT * 
			FROM cs_cheatsheet
			WHERE user_id = ' . $this->user->id . '
			
		'));
        $this->tpl->view('cheatsheet/list');
    }
开发者ID:anatoliychakkaev,项目名称:webdesk,代码行数:10,代码来源:cs.php

示例3: my

    function my()
    {
        if ($this->user->logged_in) {
            $sql = '
				SELECT note.*, user.name as author_name
				FROM note INNER JOIN user ON user.id = note.user_id
				WHERE user_id = ' . (int) $this->user->id . '
				ORDER BY id DESC
				LIMIT 20
			';
            $this->tpl->add('index', db_fetch_all($sql));
        }
        $this->tpl->view('note.index');
    }
开发者ID:anatoliychakkaev,项目名称:webdesk,代码行数:14,代码来源:note.php

示例4: kfmSession

 function kfmSession($key = '')
 {
     global $kfm;
     parent::__construct();
     $create = 1;
     if ($GLOBALS['kfm_do_not_save_session']) {
         $this->key = 'fake';
         $this->vars = array();
         return;
     }
     if ($key == '' && isset($_COOKIE['kfm_cookie']) && strlen($_COOKIE['kfm_cookie']) == 32) {
         $key = $_COOKIE['kfm_cookie'];
     }
     if ($key != '' && strlen($key) == 32) {
         $res = db_fetch_row("SELECT id FROM " . KFM_DB_PREFIX . "session WHERE cookie='" . $key . "'");
         if (is_array($res) && count($res)) {
             $create = 0;
             $this->id = $res['id'];
             $this->isNew = false;
             $kfm->db->query("UPDATE " . KFM_DB_PREFIX . "session SET last_accessed='" . date('Y-m-d G:i:s') . "' WHERE id='" . $this->id . "'");
             // { clean up expired session data
             $old_sessions = db_fetch_all("SELECT id FROM " . KFM_DB_PREFIX . "session WHERE last_accessed<'" . date('Y-m-d G:i:s', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'))) . "'");
             if ($old_sessions && count($old_sessions)) {
                 $old_done = 0;
                 foreach ($old_sessions as $r) {
                     if ($old_done++ == 10) {
                         break;
                     }
                     $kfm->db->query('DELETE FROM ' . KFM_DB_PREFIX . 'session_vars WHERE session_id=' . $r['id']);
                     $kfm->db->query('DELETE FROM ' . KFM_DB_PREFIX . 'session WHERE id=' . $r['id']);
                 }
             }
             // }
         }
     }
     if ($create) {
         $kfm->db->query("INSERT INTO " . KFM_DB_PREFIX . "session (last_accessed) VALUES ('" . date('Y-m-d G:i:s') . "')");
         $this->id = $kfm->db->lastInsertId(KFM_DB_PREFIX . 'session', 'id');
         $key = md5($this->id);
         $kfm->db->query("UPDATE " . KFM_DB_PREFIX . "session SET cookie='" . $key . "' WHERE id=" . $this->id);
         $this->isNew = true;
         $this->setMultiple(array('cwd_id' => 1, 'language' => '', 'user_id' => 1, 'username' => '', 'password' => '', 'loggedin' => 0, 'theme' => false));
     }
     $this->key = $key;
     $this->vars = array();
     setcookie('kfm_cookie', $key, 0, '/');
 }
开发者ID:Mayoh,项目名称:grupo-ha,代码行数:47,代码来源:kfmSession.php

示例5: checkAdminPermisson

}
if (CHECK_ADMIN_PERMISSION) {
    $result = checkAdminPermisson();
    if (!$result) {
        operation_fail("你没有管理员权限");
    }
}
if (GIANT_LOCK) {
    giant_lock();
}
$__script_start_time = microtime(true);
if (CHECK_IMEI) {
    $ban_imeis = apcfetch("BAN_IMEIS");
    if (!$ban_imeis) {
        $ban_imeis = array();
        $data = db_fetch_all("select imei from ban_phone");
        foreach ($data as $e) {
            $imei = $e["imei"];
            $ban_imeis[$imei] = 1;
        }
    }
    $_imei = imei();
    $_ip = getIp();
    if (isset($ban_imeis[$_imei]) || isset($ban_imeis[$_ip])) {
        operation_fail("hello" . $_imei . language_message("ban_imei"));
    }
}
if (FORBID_VIRTUAL_MACHINE) {
    if (!isset($iamgod) && $_imei == "000000000000000") {
        operation_fail(language_message("forbid_virtual_machine"));
    }
开发者ID:QingkaiLi,项目名称:task,代码行数:31,代码来源:common.php

示例6: isset

<?php

require_once 'initialise.php';
require_once 'functions.php';
$uid = $kfm->isAdmin() && isset($_POST['uid']) && is_numeric($_POST['uid']) ? $_POST['uid'] : $kfm->user_id;
$mysets = db_fetch_all('SELECT name, value FROM ' . KFM_DB_PREFIX . 'settings WHERE user_id=' . $uid);
$ismodal = isset($_REQUEST['ismodal']) ? $_REQUEST['ismodal'] : 0;
$my_settings = array();
foreach ($mysets as $myset) {
    $my_settings[$myset['name']] = $myset['value'];
}
// Convert array to Hash
list($settings, $usersettings) = get_settings($uid);
// $settings as database values
// Needed to hide usersetting combo in modal view for non admin users when setting is usersetting anyway
if ($ismodal) {
    list($default_db_settings, $default_db_usersettings) = get_settings(1);
}
//foreach($mysets as &$myset)$myset=$myset['name'];
$js = '';
$sprefix = 'kfm_setting_';
// Until now a dummy prefix for settings. Maybe needed for future things. Also in index.php
$str = '<div id="settings_container_' . $uid . '" class="settings_container ui-widget ui-widget-content"><table class="settings_table">
<tbody>';
$user_is_administrator = $kfm->isAdmin($uid);
foreach ($kfm->sdef as $sname => $sdef) {
    $is_usersetting = in_array($sname, $usersettings);
    if (!$kfm->isAdmin() && !$is_usersetting) {
        continue;
    }
    // Do not process settings the user has no rights to
开发者ID:Mayoh,项目名称:grupo-ha,代码行数:31,代码来源:settings.php

示例7: die

<?php

require_once 'initialise.php';
require_once 'functions.php';
if ($kfm->user_status != 1) {
    die('error("No authorization aquired")');
}
if (!(isset($_POST['username']) && isset($_POST['password']))) {
    die('$.prompt("error with new user request");');
}
$res = db_fetch_all('SELECT id FROM ' . KFM_DB_PREFIX . 'users WHERE username="' . $_POST['username'] . '"');
if (count($res)) {
    die('$.prompt("Name already exists.");');
}
$kfm->db->query('INSERT INTO ' . KFM_DB_PREFIX . 'users (username, password,status) VALUES ("' . $_POST['username'] . '", "' . sha1($_POST['password']) . '", 2)');
if (PEAR::isError($kfmdb)) {
    die('$.prompt("error with database interactions");');
}
$uhtml = user_row($kfm->db->lastInsertId(), $_POST['username'], 2);
$uhtml = preg_replace('/\\n/', '', $uhtml);
$uhtml = str_replace("'", "\\'", $uhtml);
echo '$("#kfm_admin_users_table tbody").append(\'' . $uhtml . '\');';
?>
message('user created');
开发者ID:Bandeira,项目名称:sps,代码行数:24,代码来源:user_new.php

示例8: db_field_data

function db_field_data($table)
{
    static $meta = array();
    if (!isset($meta[$table])) {
        $fields = db_fetch_all("SHOW COLUMNS FROM {$table}");
        $result = array();
        foreach ($fields as $fld) {
            $row = array();
            $row['type'] = preg_replace('/(\\(.*\\))/', '', $fld['Type']);
            $row['name'] = $fld['Field'];
            $row['primary'] = $fld['Key'] == 'PRI';
            $result[] = $row;
        }
        $meta[$table] = $result;
    }
    return $meta[$table];
}
开发者ID:londomloto,项目名称:immortal,代码行数:17,代码来源:database.php

示例9: deleteThumbs

 function deleteThumbs()
 {
     $rs = db_fetch_all("SELECT id FROM " . KFM_DB_PREFIX . "files_images_thumbs WHERE image_id=" . $this->id);
     foreach ($rs as $r) {
         $icons = glob(WORKPATH . 'thumbs/' . $r['id'] . '*');
         foreach ($icons as $f) {
             unlink($f);
         }
     }
     $GLOBALS['kfm']->db->exec("DELETE FROM " . KFM_DB_PREFIX . "files_images_thumbs WHERE image_id=" . $this->id);
 }
开发者ID:raylouis,项目名称:kvwebme,代码行数:11,代码来源:kfmImage.php

示例10: getTags

 /**
  * Get the tags of the file
  * @return Array
  */
 function getTags()
 {
     $arr = array();
     $tags = db_fetch_all("select tag_id from " . KFM_DB_PREFIX . "tagged_files where file_id=" . $this->id);
     foreach ($tags as $r) {
         $arr[] = $r['tag_id'];
     }
     return $arr;
 }
开发者ID:blumine,项目名称:vunsy,代码行数:13,代码来源:file.class.php

示例11: _search

function _search($keywords, $tags)
{
    global $kfmdb;
    $files = array();
    $valid_files = array();
    if ($tags) {
        $arr = explode(',', $tags);
        foreach ($arr as $tag) {
            $tag = ltrim(rtrim($tag));
            if ($tag) {
                $r = db_fetch_row("select id from " . KFM_DB_PREFIX . "tags where name='" . sql_escape($tag) . "'");
                if (count($r)) {
                    $constraints = '';
                    if (count($valid_files)) {
                        $constraints = ' and (file_id=' . join(' or file_id=', $valid_files) . ')';
                    }
                    $rs2 = db_fetch_all("select file_id from " . KFM_DB_PREFIX . "tagged_files where tag_id=" . $r['id'] . $constraints);
                    if (count($rs2)) {
                        $valid_files = array();
                        foreach ($rs2 as $r2) {
                            $valid_files[] = $r2['file_id'];
                        }
                    } else {
                        $valid_files = array(0);
                    }
                }
            }
        }
    }
    if ($tags && count($valid_files) || $keywords) {
        # keywords
        $constraints = '';
        if (count($valid_files)) {
            $constraints = ' and (id=' . join(' or id=', $valid_files) . ')';
        }
        $fs = db_fetch_all("select id from " . KFM_DB_PREFIX . "files where name like '%" . sql_escape($keywords) . "%'" . $constraints . " order by name");
        foreach ($fs as $f) {
            $file = kfmFile::getInstance($f['id']);
            if (!$file->checkName()) {
                continue;
            }
            unset($file->db);
            $files[] = _getFileDetails($f['id']);
        }
    }
    return array('reqdir' => kfm_lang('searchResults'), 'files' => $files, 'uploads_allowed' => 0);
}
开发者ID:lxthien,项目名称:batdongsan,代码行数:47,代码来源:files.php

示例12: irc_search

function irc_search($search, $num_rows)
{
    $sql = "SELECT * FROM " . CHAT_TABLE . " WHERE MATCH(utterance) AGAINST (?)  ORDER BY stamp DESC LIMIT {$num_rows}";
    return db_fetch_all($sql, array($search));
}
开发者ID:browserplus,项目名称:hackthebrowser,代码行数:5,代码来源:db.php

示例13: die

<?php

require_once 'initialise.php';
if (isset($_POST['uid'])) {
    if ($kfm->user_status == 1) {
        $uid = $_POST['uid'];
    } else {
        die('error("Unauthorized attempt to change a users password");');
    }
} else {
    $uid = $kfm->user_id;
}
if (!isset($_POST['npw']) || !isset($_POST['npw2'])) {
    die('error("Error: no new passwords given.");');
}
$sql = 'SELECT id FROM ' . KFM_DB_PREFIX . 'users WHERE id="' . $uid . '" AND password="' . sha1($_POST['opw']) . '"';
if (!count(db_fetch_all($sql))) {
    die('error("Old password is not correct");');
}
if ($_POST['npw'] != $_POST['npw2']) {
    die('error("The passwords are not equal");');
}
$kfmdb->query('UPDATE ' . KFM_DB_PREFIX . 'users SET password="' . sha1($_POST['npw']) . '" WHERE id=' . $uid);
if ($uid == $kfm->user_id) {
    $kfm_session->set('password', $_POST['npw']);
}
?>
message('Password changed');
开发者ID:Bandeira,项目名称:sps,代码行数:28,代码来源:password_change.php

示例14: get_all_items_category

function get_all_items_category($category)
{
    return db_fetch_all("SELECT i.* FROM Item AS i INNER JOIN Item_category AS b ON i.id = b.item_id AND b.category_id='{$category}'");
}
开发者ID:huang4fstudio,项目名称:comp3013_project,代码行数:4,代码来源:items.php

示例15: die

<?php

require_once 'initialise.php';
require_once 'functions.php';
if (!($kfm->isAdmin() || $kfm->setting('allow_user_file_associations'))) {
    die('Users are not allowed to create their own file associations');
}
//$kfm->requireAdmin();
//if($kfm->user_status!=1)die ('No authorization to view this page');
$uid = $kfm->user_id;
$extensions = db_fetch_all('SELECT * FROM ' . KFM_DB_PREFIX . 'plugin_extensions WHERE user_id=' . $uid);
?>
<script type="text/javascript">
$(function(){
          $('#new_association_blueprint').dialog({
            modal: true,
            autoOpen: false,
            width: 500,
            buttons:{ 'Add extension': function(){
                var ext = $('#new_association_extension');
                var plugin = $('#plugin_selector_0222');
				        $.post('association_new.php',{extension:ext.val(),plugin:plugin.val()},function(res){eval(res);});
                $(this).dialog('close');
              }
            }
          });
});
function new_association(){
  $('#new_association_blueprint').dialog('open');
}
function change_association_plugin(id){
开发者ID:Mayoh,项目名称:grupo-ha,代码行数:31,代码来源:associations.php


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