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


PHP db_query_array函数代码示例

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


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

示例1: string

 public static function string($key = false)
 {
     global $CFG;
     if (empty($key)) {
         return false;
     }
     $lang = empty($CFG->language) ? 'eng' : $CFG->language;
     if ($lang == 'en') {
         $lang = 'eng';
     } else {
         if ($lang == 'es') {
             $lang = 'esp';
         }
     }
     if ($CFG->memcached) {
         $cached = $CFG->m->get('lang_' . $key . '_' . $lang);
         if ($cached) {
             return $cached;
         }
     }
     $sql = 'SELECT ' . $lang . ' AS line FROM lang WHERE `key` = "' . $key . '" LIMIT 0,1';
     $result = db_query_array($sql);
     if ($result) {
         if ($CFG->memcached) {
             $CFG->m->set('lang_' . $key . '_' . $lang, $result[0]['line'], 300);
         }
         return $result[0]['line'];
     } else {
         return false;
     }
 }
开发者ID:MirellJ,项目名称:wlox-api,代码行数:31,代码来源:Lang.php

示例2: getReserveSurplus

 public static function getReserveSurplus()
 {
     global $CFG;
     $reserve_ratio = $CFG->bitcoin_reserve_ratio ? $CFG->bitcoin_reserve_ratio : '0';
     $sending_fee = $CFG->bitcoin_sending_fee ? $CFG->bitcoin_sending_fee : '0';
     $sql = 'SELECT (hot_wallet_btc - ((total_btc * ' . $reserve_ratio . ') + pending_withdrawals) - ' . $sending_fee . ') AS surplus, hot_wallet_btc FROM status WHERE id = 1';
     $result = db_query_array($sql);
     if (!$result) {
         return 0;
     }
     return $result[0];
 }
开发者ID:MirellJ,项目名称:wlox-cron,代码行数:12,代码来源:Status.php

示例3: getForApp

 public static function getForApp()
 {
     global $CFG;
     $return = array('user' => array(), 'sexos' => array(), 'content_cats' => array(), 'event_cats' => array(), 'hatzalah_phone' => $CFG->hatzalah_phone, 'dsi_phone' => $CFG->dsi_phone);
     if (!empty(User::$info)) {
         $return['user'] = User::$info;
         $status = User::getUserStatus();
         $return['user']['status'] = $status[User::$info['site_users_status']]['key'];
         unset($return['user']['nonce']);
         unset($return['user']['session_key']);
         unset($return['user']['ip']);
         unset($return['user']['awaiting']);
         unset($return['user']['id']);
         unset($return['user']['reg_date']);
         unset($return['user']['last_login']);
         unset($return['user']['user']);
         unset($return['user']['pass']);
         unset($return['user']['site_users_status']);
     }
     $sql = 'SELECT * FROM sexos';
     $result = db_query_array($sql);
     if ($result) {
         foreach ($result as $row) {
             $return['sexos'][$row['id']] = $row['name'];
         }
     }
     $return['content_cats'] = Content::getTopics();
     $return['event_cats'] = Events::getCats();
     return $return;
 }
开发者ID:shevet-ahim,项目名称:backend,代码行数:30,代码来源:Settings.php

示例4: getRecord

 public static function getRecord($url)
 {
     global $CFG;
     $url = preg_replace("/[^0-9a-zA-Z!@#\$%&*?\\.\\-_]/", "", $url);
     if (empty($url)) {
         return false;
     }
     if ($CFG->memcached) {
         $cached = $CFG->m->get('content_' . $url . '_' . $CFG->language);
         if ($cached) {
             return $cached;
         }
     }
     $sql = "SELECT * FROM content WHERE url = '{$url}' ";
     $result = db_query_array($sql);
     if ($result) {
         $result[0]['title'] = empty($result[0]['title_' . $CFG->language]) ? $result[0]['title'] : $result[0]['title_' . $CFG->language];
         $result[0]['content'] = empty($result[0]['content_' . $CFG->language]) ? $result[0]['content'] : $result[0]['content_' . $CFG->language];
         $result[0]['title'] = str_replace('[exchange_name]', $CFG->exchange_name, str_replace('[baseurl]', $CFG->frontend_baseurl, $result[0]['title']));
         $result[0]['content'] = str_replace('[exchange_name]', $CFG->exchange_name, str_replace('[baseurl]', $CFG->frontend_baseurl, $result[0]['content']));
         if ($CFG->memcached) {
             $CFG->m->set('content_' . $url . '_' . $CFG->language, $result[0], 300);
         }
         return $result[0];
     }
     return false;
 }
开发者ID:MirellJ,项目名称:wlox-api,代码行数:27,代码来源:Content.php

示例5: save

 function save()
 {
     $table = $_REQUEST['pe_table'];
     $g_id = $_REQUEST['pe_group_id'];
     if (is_array($_REQUEST['pe']['tabs'])) {
         foreach ($_REQUEST['pe']['tabs'] as $id => $permission) {
             if ($result = db_query_array("SELECT id FROM {$table}_groups_tabs WHERE tab_id = {$id} && group_id = {$g_id}")) {
                 $r_id = $result[0]['id'];
                 DB::update("{$table}_groups_tabs", array('permission' => $permission), $r_id);
             } else {
                 DB::insert("{$table}_groups_tabs", array('permission' => $permission, 'tab_id' => $id, 'group_id' => $g_id));
             }
         }
     }
     if (is_array($_REQUEST['pe']['pages'])) {
         foreach ($_REQUEST['pe']['pages'] as $id => $permission) {
             if ($result = db_query_array("SELECT id FROM {$table}_groups_pages WHERE page_id = {$id} && group_id = {$g_id}")) {
                 $r_id = $result[0]['id'];
                 DB::update("{$table}_groups_pages", array('permission' => $permission), $r_id);
             } else {
                 DB::insert("{$table}_groups_pages", array('permission' => $permission, 'page_id' => $id, 'group_id' => $g_id));
             }
         }
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:25,代码来源:PermissionEditor.php

示例6: getRecord

 public static function getRecord($table, $id = 0, $f_id = 0, $id_required = false, $f_id_field = false, $order_by = false, $order_asc = false, $for_update = false)
 {
     if ($id_required && !($id > 0)) {
         return false;
     }
     if (!$table) {
         return false;
     }
     $f_id_field = $f_id_field ? $f_id_field : 'f_id';
     $sql = "SELECT {$table}.* FROM {$table} WHERE 1 ";
     if ($id > 0) {
         $sql .= " AND  {$table}.id = {$id} ";
     }
     if ($f_id) {
         $sql .= " AND  {$table}.{$f_id_field} = '{$f_id}' ";
     }
     if ($order_by) {
         $order_asc = $order_asc ? 'ASC' : 'DESC';
         $sql .= " ORDER BY {$order_by} {$order_asc} ";
     }
     $sql .= " LIMIT 0,1 ";
     if ($for_update) {
         $sql .= ' FOR UPDATE';
     }
     $result = db_query_array($sql);
     return $result[0];
 }
开发者ID:MirellJ,项目名称:wlox-api,代码行数:27,代码来源:DB.php

示例7: getUserFees

 public static function getUserFees($user_id = false)
 {
     global $CFG;
     if (!$user_id) {
         return false;
     }
     if (!empty(self::$user_fees[$user_id])) {
         return self::$user_fees[$user_id];
     }
     if ($CFG->memcached) {
         $cached = $CFG->m->get('user_fee_' . $user_id);
         if ($cached) {
             self::$user_fees[$user_id] = $cached;
             return $cached;
         }
     }
     $sql = 'SELECT fee_schedule.fee, fee_schedule.fee1 FROM fee_schedule LEFT JOIN site_users ON (site_users.fee_schedule = fee_schedule.id) WHERE site_users.id = ' . $user_id . ' LIMIT 0,1';
     $result = db_query_array($sql);
     if ($result) {
         if ($CFG->memcached) {
             $CFG->m->set('user_fee_' . $user_id, $result[0], 300);
         }
         self::$user_fees[$user_id] = $result[0];
         return $result[0];
     }
     return false;
 }
开发者ID:MirellJ,项目名称:wlox-api,代码行数:27,代码来源:FeeSchedule.php

示例8: get

 function get($route_id = '')
 {
     $sql = "SELECT * FROM routes\n                    WHERE 1 ";
     if ($route_id) {
         $sql .= " AND route_id = '" . $route_id . "'";
     }
     return db_query_array($sql);
 }
开发者ID:nagyistoce,项目名称:Shuttle-Tracker,代码行数:8,代码来源:route.php

示例9: get

 function get($shuttle_id = '')
 {
     $sql = "SELECT * FROM shuttles\n                    WHERE 1 ";
     if ($shuttle_id) {
         $sql .= " AND shuttle_id = '" . $shuttle_id . "'";
     }
     return db_query_array($sql);
 }
开发者ID:nagyistoce,项目名称:Shuttle-Tracker,代码行数:8,代码来源:shuttle.php

示例10: getUserFees

 public static function getUserFees($user_id = false)
 {
     if (!$user_id) {
         return false;
     }
     $sql = 'SELECT fee_schedule.* FROM fee_schedule LEFT JOIN site_users ON (site_users.fee_schedule = fee_schedule.id) WHERE site_users.id = ' . $user_id . ' LIMIT 0,1';
     $result = db_query_array($sql);
     return $result ? $result[0] : false;
 }
开发者ID:MirellJ,项目名称:wlox-cron,代码行数:9,代码来源:FeeSchedule.php

示例11: getHighestProxy

 function getHighestProxy($user_id = 0)
 {
     $sql = "SELECT amount,user_id FROM {$this->table}_bids WHERE item_id = {$this->id} AND item_table = '{$this->table}' ";
     if ($user_id > 0) {
         $sql .= " AND user_id = {$user_id} ";
     }
     $sql .= " ORDER BY amount DESC LIMIT 0,1";
     $result = db_query_array($sql);
     return $result[0];
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:10,代码来源:Auction.php

示例12: execute_array

function execute_array($sql, $args = array())
{
    $result = db_query_array($sql, $args);
    if ($result === FALSE) {
        trigger_error("Query failed in execute: {$sql}", E_USER_ERROR);
    }
    if (is_resource($result)) {
        mysql_free_result($result);
    }
    return mysql_affected_rows();
}
开发者ID:rickyw,项目名称:LiveReload2,代码行数:11,代码来源:database.php

示例13: get

 function get($shuttle_id = '')
 {
     $sql = "SELECT * FROM shuttle_coords\n                    WHERE 1 ";
     if ($route_id) {
         $sql .= " AND shuttle_id = '" . $shuttle_id . "'";
     }
     if ($seq) {
         $sql .= " AND seq = '" . $seq . "'";
     }
     return db_query_array($sql);
 }
开发者ID:nagyistoce,项目名称:Shuttle-Tracker,代码行数:11,代码来源:shuttlecoords.php

示例14: get

 public static function get()
 {
     $sql = "SELECT * FROM currencies WHERE is_active = 'Y' ORDER BY currency ASC";
     $result = db_query_array($sql);
     if ($result) {
         foreach ($result as $row) {
             $currencies[$row['currency']] = $row;
             $currencies[$row['id']] = $row;
         }
     }
     return $currencies;
 }
开发者ID:MirellJ,项目名称:wlox-cron,代码行数:12,代码来源:Currencies.php

示例15: get

 public static function get()
 {
     $sql = 'SELECT * FROM date_overrides WHERE `date` >= "' . date('Y-m-d', strtotime('-1 month')) . '" AND `date` <= "' . date('Y-m-d', strtotime('+1 month')) . '" ORDER BY `date` DESC';
     $result = db_query_array($sql);
     if (!$result) {
         return false;
     }
     $return = array();
     foreach ($result as $row) {
         $return[$row['date']] = array('neitz_hachama' => strtotime($row['date'] . ' ' . substr($row['netz'], strrpos($row['netz'], ' ') + 1)) * 1000, 'sof_zman_shma' => strtotime($row['date'] . ' ' . substr($row['shema'], strrpos($row['shema'], ' ') + 1)) * 1000, 'sof_zman_tfilla' => strtotime($row['date'] . ' ' . substr($row['tefilah'], strrpos($row['tefilah'], ' ') + 1)) * 1000, 'mincha_gedola' => strtotime($row['date'] . ' ' . substr($row['minha_gedola'], strrpos($row['minha_gedola'], ' ') + 1)) * 1000, 'mincha_ketana' => strtotime($row['date'] . ' ' . substr($row['minha_ketana'], strrpos($row['minha_ketana'], ' ') + 1)) * 1000, 'shkiah' => strtotime($row['date'] . ' ' . substr($row['shekia'], strrpos($row['shekia'], ' ') + 1)) * 1000, 'tzeit' => strtotime($row['date'] . ' ' . substr($row['tzet'], strrpos($row['tzet'], ' ') + 1)) * 1000, 'candles' => $row['candles'] > 0 ? strtotime($row['date'] . ' ' . substr($row['candles'], strrpos($row['candles'], ' ') + 1)) * 1000 : 0);
     }
     return $return;
 }
开发者ID:shevet-ahim,项目名称:backend,代码行数:13,代码来源:DateOverrides.php


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