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


PHP DataBase::getDB方法代码示例

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


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

示例1: editCollection

 static function editCollection($data)
 {
     $db = DataBase::getDB();
     $collection = $db->{$data}['collection'];
     $nuevosdatos = array('$set' => array("name" => $data['name'], "firm" => $data['firm'], "email" => $data['email'], "type" => $data['type']));
     $collection->update(array('_id' => new MongoId($data['mongoid'])), $nuevosdatos);
 }
开发者ID:madoos,项目名称:iwonder,代码行数:7,代码来源:dataBase.php

示例2: get_data

 public function get_data()
 {
     $db = DataBase::getDB();
     // Создаём объект базы данных
     $query = "SELECT ap_id, ap_url, ap_time, ap_title, ap_anons, ap_content FROM articles_pages WHERE `ap_enable` = '1'";
     $reply = $db->select($query);
     return $reply;
 }
开发者ID:Alexander-Erokhin,项目名称:First-project,代码行数:8,代码来源:model_articles.php

示例3: __construct

 public function __construct($table_name)
 {
     $this->db = DataBase::getDB();
     $this->format = new Format();
     $this->config = new Config();
     $this->check = new Check();
     $this->url = new URL();
     $this->table_name = $this->config->db_prefix . $table_name;
 }
开发者ID:kuaa59,项目名称:www,代码行数:9,代码来源:global_class.php

示例4: get_data_bd

 public function get_data_bd($page_name = 'index')
 {
     //Получаем данные страницы title, описание.
     $db = DataBase::getDB();
     // Создаём объект базы данных
     $query = "SELECT id, name, url, title, description, keywords, text, show_page FROM `basic_pages` WHERE `url` = '{$page_name}'";
     $reply = $db->select($query);
     return $reply;
 }
开发者ID:Alexander-Erokhin,项目名称:First-project,代码行数:9,代码来源:model.php

示例5: getSiteData

 public static function getSiteData()
 {
     $DB = DataBase::getDB();
     $query = " SELECT `id` " . " FROM `users` ";
     $site['total_users'] = count($DB->select($query));
     $query = " SELECT `username` " . " FROM `users` " . " WHERE (`login_time` + 30*60) > " . time();
     $site['online_users'] = $DB->select($query);
     $site['online_count'] = count($site['online_users']);
     Registry::set('site', $site);
 }
开发者ID:helloris25,项目名称:mvc,代码行数:10,代码来源:tools_class.php

示例6: __construct

 public function __construct($table_name)
 {
     $this->db = DataBase::getDB();
     $this->format = new Format();
     $this->config = new Config();
     $this->check = new Check();
     $this->url = new Url();
     $this->table_name = $this->config->db_prefix . $table_name;
     //определяем полное название таблицы
 }
开发者ID:Tatiway,项目名称:online-shop,代码行数:10,代码来源:global_class.php

示例7: getUserObj

 public static function getUserObj($value, $what = '*', $column = '`id`')
 {
     $DB = DataBase::getDB();
     $query = " SELECT " . $what . " FROM `users` " . " WHERE " . $column . " = {?}";
     $params = array($value);
     $userData = $DB->selectRow($query, $params);
     if (!empty($userData)) {
         return new Users($userData);
     } else {
         return false;
     }
 }
开发者ID:helloris25,项目名称:mvc,代码行数:12,代码来源:users_class.php

示例8: get_data_table_all

 public function get_data_table_all($mark, $model = 0)
 {
     $db = DataBase::getDB();
     // Создаём объект базы данных
     //Если выбрана марка и модель то подгружаем и марку и модель иначе марку
     if ($model) {
         $query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "' AND `ddl_model` = '" . DataBase::mysql_prep($model) . "'";
     } else {
         $query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "' GROUP BY ddl_model";
     }
     $reply = $db->select($query);
     return $reply;
 }
开发者ID:Alexander-Erokhin,项目名称:First-project,代码行数:13,代码来源:model_dvigateli_dlya_legkovyh.php

示例9: get_data_table_all

 public function get_data_table_all($mark, $number_view = 'all')
 {
     $db = DataBase::getDB();
     // Создаём объект базы данных
     //Проверяем показывать все модели или первые 20
     if ($number_view === 'all') {
         $query = "SELECT kdg_id, kdg_mark, kdg_mark_title, kdg_model, kdg_model_title, kdg_year, kdg_price, kdg_images, kdg_show FROM `kabiny_dlya_gruzovyh` WHERE `kdg_mark` = '" . DataBase::mysql_prep($mark) . "'";
     } else {
         $query = "SELECT kdg_id, kdg_mark, kdg_mark_title, kdg_model, kdg_model_title, kdg_year, kdg_price, kdg_images, kdg_show FROM `kabiny_dlya_gruzovyh` WHERE `kdg_mark` = '" . DataBase::mysql_prep($mark) . "' GROUP BY kdg_model LIMIT " . DataBase::mysql_prep($number_view);
     }
     $reply = $db->select($query);
     return $reply;
 }
开发者ID:Alexander-Erokhin,项目名称:First-project,代码行数:13,代码来源:model_kabiny_dlya_gruzovyh.php

示例10: get_data_table_all

 public function get_data_table_all($mark, $number_view = 'all')
 {
     $db = DataBase::getDB();
     // Создаём объект базы данных
     //Проверяем показывать все моделт или первые 20
     if ($number_view === 'all') {
         $query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "'";
     } else {
         $query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "' GROUP BY ddl_model LIMIT " . DataBase::mysql_prep($number_view);
     }
     $reply = $db->select($query);
     return $reply;
 }
开发者ID:Alexander-Erokhin,项目名称:First-project,代码行数:13,代码来源:model_reload_table.php

示例11: get_data

 public function get_data($filter_page, $filter)
 {
     switch ($filter_page) {
         case 'dvigateli_dlya_legkovyh':
             if ($filter) {
                 //Перебором подставляем все данные которые были выбраны
                 foreach ($filter as $filter_key => $filter_value) {
                     if (!empty($filter_value)) {
                         if (!isset($filter_query)) {
                             if ($filter_key == "ddl_year") {
                                 $filter_query = " ('" . DataBase::mysql_prep($filter_value) . "' >= ddl_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= ddl_year_to)";
                             } else {
                                 $filter_query = "`" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
                             }
                         } else {
                             if ($filter_key == "ddl_year") {
                                 $filter_query .= " AND ('" . $filter_value . "' >= ddl_year_from AND '" . $filter_value . "' <= ddl_year_to)";
                             } else {
                                 $filter_query .= " AND `" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
                             }
                         }
                     }
                 }
                 //Делаем запрос для фильтра
                 $db = DataBase::getDB();
                 // Создаём объект базы данных
                 $query = "SELECT ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY ddl_model, ddl_volume_cars, ddl_year_from";
                 $reply['data_selection'] = $db->select($query);
                 //Делаем запрос для таблицы
                 $db = DataBase::getDB();
                 // Создаём объект базы данных
                 $query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY ddl_model, ddl_volume_cars, ddl_year_from";
                 //echo $query;
                 $reply['data_table'] = $db->select($query);
                 //Если пустая выдача
                 if (empty($reply['data_table']) || empty($reply['data_selection'])) {
                     unset($reply['data_table']);
                     unset($reply['data_selection']);
                     return false;
                 } else {
                     return $reply;
                 }
             } else {
                 return false;
             }
             break;
         case 'kpp_dlya_legkovyh':
             if ($filter) {
                 //Перебором подставляем все данные которые были выбраны
                 foreach ($filter as $filter_key => $filter_value) {
                     if (!empty($filter_value)) {
                         if (!isset($filter_query)) {
                             if ($filter_key == "kdl_year") {
                                 $filter_query = " ('" . DataBase::mysql_prep($filter_value) . "' >= kdl_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= kdl_year_to)";
                             } else {
                                 $filter_query = "`" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
                             }
                         } else {
                             if ($filter_key == "kdl_year") {
                                 $filter_query .= " AND ('" . DataBase::mysql_prep($filter_value) . "' >= kdl_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= kdl_year_to)";
                             } else {
                                 $filter_query .= " AND `" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
                             }
                         }
                     }
                 }
                 //Делаем запрос для фильтра
                 $db = DataBase::getDB();
                 // Создаём объект базы данных
                 $query = "SELECT kdl_model, kdl_model_title, kdl_type_engine, kdl_transmission, kdl_volume_cars, kdl_year_from, kdl_year_to FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY kdl_model, kdl_volume_cars, kdl_year_from";
                 $reply['data_selection'] = $db->select($query);
                 //Делаем запрос для таблицы
                 $db = DataBase::getDB();
                 // Создаём объект базы данных
                 $query = "SELECT kdl_id, kdl_mark, kdl_mark_title, kdl_model, kdl_model_title, kdl_type_engine, kdl_transmission, kdl_volume_cars, kdl_year_from, kdl_year_to, kdl_name_engine, kdl_price FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY kdl_model, kdl_volume_cars, kdl_year_from";
                 $reply['data_table'] = $db->select($query);
                 //Если пустая выдача
                 if (empty($reply['data_table']) || empty($reply['data_selection'])) {
                     unset($reply['data_table']);
                     unset($reply['data_selection']);
                     return false;
                 } else {
                     return $reply;
                 }
             } else {
                 return false;
             }
             break;
         case 'dvigateli_dlya_gruzovyh':
             if ($filter) {
                 //Перебором подставляем все данные которые были выбраны
                 foreach ($filter as $filter_key => $filter_value) {
                     if (!empty($filter_value)) {
                         if (!isset($filter_query)) {
                             if ($filter_key == "ddg_year") {
                                 $filter_query = " ('" . DataBase::mysql_prep($filter_value) . "' >= ddg_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= ddg_year_to)";
                             } else {
                                 $filter_query = "`" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
                             }
                         } else {
//.........这里部分代码省略.........
开发者ID:Alexander-Erokhin,项目名称:First-project,代码行数:101,代码来源:model_filter_reload.php

示例12: __construct

 function __construct()
 {
     if (!Registry::get('mysql_error')) {
         $this->DB = DataBase::getDB();
     }
 }
开发者ID:helloris25,项目名称:mvc,代码行数:6,代码来源:model.php

示例13: __construct

 function __construct()
 {
     $this->DB = DataBase::getDB();
 }
开发者ID:helloris25,项目名称:mvc,代码行数:4,代码来源:model.php

示例14: unique

 public function unique($column, $value)
 {
     $DB = DataBase::getDB();
     $query = " SELECT * " . " FROM `" . self::table() . "` " . " WHERE `" . $column . "` = {?}";
     $params = array($this->{$value});
     if (count($DB->select($query, $params)) == 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:helloris25,项目名称:mvc,代码行数:11,代码来源:activerecord.php

示例15: resultSetToArray

            } else {
                return $this->mysqli->insert_id;
            }
        } else {
            return false;
        }
    }
    /* Преобразование result_set в двумерный массив */
    private function resultSetToArray($result_set)
    {
        $array = array();
        while (($row = $result_set->fetch_assoc()) != false) {
            $array[] = $row;
        }
        return $array;
    }
    /* При уничтожении объекта закрывается соединение с базой данных */
    public function __destruct()
    {
        if ($this->mysqli) {
            $this->mysqli->close();
        }
    }
}
$db = DataBase::getDB();
// Создаём объект базы данных
$query = "SELECT * FROM `user` WHERE `id` > {?} ";
$table = $db->select($query, array(10, 1));
// Запрос явно должен вывести таблицу, поэтому вызываем метод select()
/*$query = "SELECT `login` FROM `users` WHERE `email` = {?}";
  $login = $db->selectCell($query, array("test@mail.ru"));// Запрос должен вывести конкретную ячейку, поэтому вызываем метод selectCell()*/
开发者ID:star302b,项目名称:test,代码行数:31,代码来源:index.php


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