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


PHP database::getInstance方法代码示例

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


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

示例1: __construct

 public function __construct($BikeId = null, $BranchId = null, $Number = null)
 {
     $this->bikes_id = $BikeId;
     $this->branch_identifier = $BranchId;
     $this->number_of_bikes = $Number;
     $this->db = database::getInstance();
 }
开发者ID:asmith41,项目名称:intern,代码行数:7,代码来源:orders.php

示例2: __construct

 private function __construct()
 {
     require_once './database.class.php';
     require_once './movie.class.php';
     $this->db = database::getInstance();
     $this->db->connect();
 }
开发者ID:sherebiahtishbi,项目名称:tisbiwebsite,代码行数:7,代码来源:movierepository.php

示例3: init

 public function init()
 {
     if (database::getInstance()->isDown() || !property::getInstance()->get('collect_statistic')) {
         return;
     }
     $realip = system::getInstance()->getRealIp();
     $visittime = time();
     $browser = self::user_browser($_SERVER['HTTP_USER_AGENT']);
     $os = self::user_os($_SERVER['HTTP_USER_AGENT']);
     $cookie = $_COOKIE['source'] ?: '';
     $userid = user::getInstance()->get('id');
     if ($userid == null) {
         $userid = 0;
     }
     if ($cookie == null) {
         $settime = $visittime + 365 * 24 * 60 * 60;
         setcookie('source', system::getInstance()->md5random(), $settime, '/');
         $cookie = '';
     }
     $referer = $_SERVER['HTTP_REFERER'] ?: '';
     $path = $_SERVER['REQUEST_URI'] ?: '';
     $query = "INSERT INTO " . property::getInstance()->get('db_prefix') . "_statistic (ip, cookie, browser, os, time, referer, path, reg_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?)";
     $stmt = database::getInstance()->con()->prepare($query);
     $stmt->bindParam(1, $realip, \PDO::PARAM_STR);
     $stmt->bindParam(2, $cookie, \PDO::PARAM_STR, 32);
     $stmt->bindParam(3, $browser, \PDO::PARAM_STR);
     $stmt->bindParam(4, $os, \PDO::PARAM_STR);
     $stmt->bindParam(5, $visittime, \PDO::PARAM_INT);
     $stmt->bindParam(6, $referer, \PDO::PARAM_STR);
     $stmt->bindParam(7, $path, \PDO::PARAM_STR);
     $stmt->bindParam(8, $userid, \PDO::PARAM_INT);
     $stmt->execute();
 }
开发者ID:ZerGabriel,项目名称:ffcms,代码行数:33,代码来源:robot.class.php

示例4: init

 /**
  * Check if user is permament banned in database and display ban.tpl theme
  */
 public function init()
 {
     $ip = system::getInstance()->getRealIp();
     $time = time();
     $userid = user::getInstance()->get('id');
     if ($userid > 0) {
         $stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE (user_id = ? or ip = ?) AND (express > ? OR express = 0)");
         $stmt->bindParam(1, $userid, \PDO::PARAM_INT);
         $stmt->bindParam(2, $ip, \PDO::PARAM_STR);
         $stmt->bindParam(3, $time, \PDO::PARAM_INT);
         $stmt->execute();
     } else {
         $stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE ip = ? AND (express > ? OR express = 0)");
         $stmt->bindParam(1, $ip, \PDO::PARAM_STR);
         $stmt->bindParam(2, $time, \PDO::PARAM_INT);
         $stmt->execute();
     }
     $rowFetch = $stmt->fetch();
     $count = $rowFetch[0];
     if ($count > 0) {
         // block founded in db
         $content = template::getInstance()->twigRender('ban.tpl', array('local' => array('admin_email' => property::getInstance()->get('mail_from'))));
         template::getInstance()->justPrint($content);
     }
 }
开发者ID:ZerGabriel,项目名称:ffcms,代码行数:28,代码来源:ban.class.php

示例5: __construct

 function __construct($un = null, $pwd = null, $branch_n = null, $branch_location = null)
 {
     $this->username = $un;
     $this->password = $pwd;
     $this->branch_name = $branch_n;
     $this->branch_location = $branch_location;
     $this->db = database::getInstance();
 }
开发者ID:asmith41,项目名称:intern,代码行数:8,代码来源:Branch.php

示例6: __construct

 public function __construct($number = null, $brand_id = null, $branch_identifier = null, $limit_set = null)
 {
     $this->db = database::getInstance();
     $this->bike_id = $brand_id;
     $this->number_of_items = $number;
     $this->branch_id = $branch_identifier;
     $this->limit = $limit_set;
 }
开发者ID:asmith41,项目名称:intern,代码行数:8,代码来源:inventory.php

示例7: __construct

 public function __construct($id = 0)
 {
     $this->pdo = database::getInstance();
     if ($id != 0) {
         $this->id = $id;
         $this->getFromDatabase();
     }
 }
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:8,代码来源:address.php

示例8: get_title

function get_title()
{
    $db_once = database::getInstance();
    $sql = "SELECT * FROM common_entry where ID = 1";
    $row = $db_once->getDataSingle($sql);
    $Name = $row['Name'];
    echo $Name;
    //$db_once->closeConn();
}
开发者ID:snowytech,项目名称:st100-db-demo,代码行数:9,代码来源:functions.php

示例9: __construct

 public function __construct($id = 0)
 {
     $this->pdo = database::getInstance();
     $this->tf = new textFinder();
     $this->products = array();
     if ($id != 0) {
         $this->id = $id;
         $this->getFromDatabase();
     }
 }
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:10,代码来源:group_products.php

示例10: __construct

 public function __construct($id = 0)
 {
     $this->pdo = database::getInstance();
     $this->tf = new textFinder();
     $this->id_address = -1;
     if ($id != 0) {
         $this->id = $id;
         $this->getFromDatabase();
     }
 }
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:10,代码来源:employee.php

示例11: __construct

 private function __construct()
 {
     require_once './database.class.php';
     require_once './event.class.php';
     /* echo 'Creating database instance. <br/>'; */
     $this->db = database::getInstance();
     /* echo 'Database instance created. <br/>';
       	echo 'Creating connection. <br/>'; */
     $this->db->connect();
     /* echo 'Database connected. <br/>'; */
 }
开发者ID:sherebiahtishbi,项目名称:fbcb,代码行数:11,代码来源:event_repository.php

示例12: getUserByEmail

 public static function getUserByEmail($email)
 {
     $db = database::getInstance();
     $stmt = $db->prepare("SELECT uid FROM users WHERE email=? LIMIT 1");
     $stmt->bind_param("s", $email);
     $db->select($stmt);
     $stmt->bind_result($id);
     if ($stmt->fetch()) {
         $stmt->close();
         return new User($id);
     }
     return NULL;
 }
开发者ID:neofutur,项目名称:BitPing.Net,代码行数:13,代码来源:users.php

示例13: __construct

 public function __construct($id = 0)
 {
     $this->pdo = database::getInstance();
     $this->tf = new textFinder();
     $this->id = $id;
     $this->name = '';
     $this->description = '';
     $this->cost = 0;
     $this->price = 0;
     $this->unit = '';
     $this->id_group = 0;
     if ($id != 0) {
         $this->getFromDatabase();
     }
 }
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:15,代码来源:product.php

示例14: getUser

 public static function getUser($username, $input)
 {
     $db = database::getInstance();
     $stmt = $db->prepare("SELECT uid,password FROM users WHERE username=? LIMIT 1");
     $stmt->bind_param("s", $username);
     $db->select($stmt);
     $stmt->bind_result($id, $password);
     if ($stmt->fetch()) {
         if (self::ValidatePassword($input, $password)) {
             $stmt->close();
             return new User($id);
         }
     }
     return NULL;
 }
开发者ID:neofutur,项目名称:BitPing.Net,代码行数:15,代码来源:user.php

示例15: __construct

 public function __construct($id = 0)
 {
     $this->pdo = database::getInstance();
     $this->id_contact = "";
     $this->id_billing_address = "";
     $this->id_receiving_address = "";
     $this->normal_billing_period = "";
     $this->receiving_address = new address();
     $this->billing_address = new address();
     $this->tf = new textFinder();
     $this->orders = array();
     $this->ordersMonth = array();
     $this->alreadyPaid = 0;
     $this->ca = 0;
     if ($id != 0) {
         $this->id = $id;
         $this->getFromDatabase();
     }
 }
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:19,代码来源:company.php


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