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


PHP MysqliDb::getInstance方法代码示例

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


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

示例1: SetProperties

 public function SetProperties($lang, $id, $name, $description)
 {
     if ($who = Registry::getInstance()->getUser()) {
         if (isset($who['user_id']) && $who['user_id']) {
             $this_prop = $this->ListProperties(array($lang), array(), array($id));
             $db = MysqliDb::getInstance();
             if ($this_prop) {
                 $data = array($this->_propertyType => $name, 'description' => $description, 'who_last_update' => $who['user_id']);
                 if ($db->where($this->_propertyType . '_id', $id)->where('language', $lang)->update($this->_propertyType . '_data', $data)) {
                     return $name;
                 } else {
                     return false;
                 }
             } else {
                 $data = array($this->_propertyType . '_id' => $id, 'language' => $lang, $this->_propertyType => $name, 'description' => $description, 'who_last_update' => $who['user_id']);
                 if ($db->insert($this->_propertyType . '_data', $data)) {
                     return true;
                 } else {
                     return false;
                 }
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:powersoftTV,项目名称:nf.dev,代码行数:28,代码来源:ManageProperties.php

示例2: showzx

function showzx()
{
    $zid = req('zid');
    $start = req('start', 0);
    $perpage = req('perpage', 0);
    if ($start < 0) {
        $start = 0;
    }
    if (empty($perpage)) {
        $perpage = 30;
    }
    if (empty($zid)) {
        showjson('zid_not_exist');
    }
    $db = MysqliDb::getInstance();
    $data = $db->rawQueryOne("SELECT z.*, u.username FROM zixun z LEFT JOIN users u ON z.uid=u.uid WHERE z.zid='{$zid}'");
    if ($db->count > 0) {
        $db->where("zid", $zid);
        $stats = $db->getOne("comment", "count(*) as cnt");
        $data['total'] = $stats['cnt'];
        //if($start>=$data['total']) $start=0;
        $comment = $db->rawQuery("SELECT c.*,s.username FROM comment c LEFT JOIN users s ON c.uid=s.uid WHERE c.zid='{$zid}' ORDER BY c.cid LIMIT {$start},{$perpage}");
        $data['count'] = $db->count;
        $data['comment'] = $comment;
        showjson('do_success', 0, array("zixun" => $data));
    }
    showjson('show_error');
}
开发者ID:NaturalWill,项目名称:Simple-Healthcare-Consulting-System-API,代码行数:28,代码来源:view.php

示例3: __construct

 public function __construct()
 {
     /** @var array $db */
     include_once 'config.php';
     require_once 'PHP-MySQLi-Database-Class-master/MysqliDb.php';
     new MysqliDb($db);
     $this->db_instance = MysqliDb::getInstance();
     $this->db_config = $db;
 }
开发者ID:akd3vs,项目名称:fer-example,代码行数:9,代码来源:Utils.php

示例4: __construct

 /**
  * constructor
  *
  * @param string $type tipo de datamanager a ser incializado
  *
  * inicializa o objeto de log e de bd
  * inicializa o vetor de dados nulo de acordo com o tipo
  */
 function __construct($type)
 {
     $this->db = MysqliDb::getInstance();
     $this->log = Log::getInstance();
     //tipo de dado valido pra iniciar
     if (array_key_exists($type, $this->_validFields)) {
         $this->type = $type;
         foreach ($this->_validFields[$this->type] as $key => $value) {
             $this->setField($key, null);
         }
     }
 }
开发者ID:andrefedalto,项目名称:htv,代码行数:20,代码来源:DataManager.php

示例5: buildOutput

/**
 * Created by PhpStorm.
 * User: André
 * Date: 01/04/2015
 * Time: 13:57
 */
function buildOutput($data, $debug = false)
{
    $log = Log::getInstance();
    $db = MysqliDb::getInstance();
    $output = array();
    if ($log->countErrors() > 0) {
        $errors = $log->getErrors();
    }
    $output = $data;
    if (isset($errors) && sizeof($errors) > 0) {
        $output['_ERROR_'] = $errors;
    }
    if ($debug == 'true') {
        $output['_DEBUG_'] = $log->getLogs();
    }
    echo json_encode($output, JSON_PRETTY_PRINT);
}
开发者ID:andrefedalto,项目名称:htv,代码行数:23,代码来源:functions.php

示例6: login

function login()
{
    $password = req('password');
    $username = req('username');
    $db = MysqliDb::getInstance();
    if ($password && $username) {
        $db->where('username', $username);
        if ($user = $db->getOne('users')) {
            if ($user['password'] == $password) {
                $auth = authcode("{$user['password']}\t{$user['uid']}", 'ENCODE');
                showjson('do_success', 0, array("auth" => rawurlencode($auth)));
            }
            showjson('password_error');
        }
    }
    showjson('login_error');
}
开发者ID:NaturalWill,项目名称:Simple-Healthcare-Consulting-System-API,代码行数:17,代码来源:user.php

示例7: checkauth

function checkauth()
{
    global $_SGLOBAL;
    $auth = req('auth');
    if ($auth) {
        $db = MysqliDb::getInstance();
        @(list($password, $uid) = explode("\t", authcode($auth, 'DECODE')));
        $_SGLOBAL['uid'] = intval($uid);
        if ($password && $_SGLOBAL['uid']) {
            $db->where('uid', $_SGLOBAL['uid']);
            if ($user = $db->getOne('users')) {
                if ($user['password'] == $password) {
                    $_SGLOBAL['usertype'] = $user['usertype'];
                    $_SGLOBAL['username'] = $user['username'];
                    return;
                }
            }
        }
    }
    showjson('to_login');
}
开发者ID:NaturalWill,项目名称:Simple-Healthcare-Consulting-System-API,代码行数:21,代码来源:common.php

示例8: comment

function comment()
{
    global $_SGLOBAL;
    checkauth();
    //验证登陆
    $op = req('op');
    $db = MysqliDb::getInstance();
    if ($op == 'add') {
        $setarr = array('uid' => $_SGLOBAL['uid']);
        $setarr['message'] = req('message');
        $setarr['zid'] = req('zid', 0);
        if ($setarr['message'] && $setarr['zid']) {
            $id = $db->insert('comment', $setarr);
            //插入数据
            if ($id) {
                showjson('do_success', 0, array("cid" => $id));
            }
            showjson('submit_comment_error');
        }
        showjson('zid_or_message_can_not_empty');
    } elseif ($op == 'del') {
        $cid = req('cid', 0);
        if (empty($cid)) {
            showjson('non_normal_operation');
        }
        $db->where('cid', $cid);
        if ($_SGLOBAL['usertype'] == 1) {
            //是否管理员
        } else {
            $db->where('uid', $_SGLOBAL['uid']);
        }
        $result = $db->delete('comment');
        //删除评论
        if ($result) {
            showjson('do_success', 0);
        }
        showjson('comment_not_exist');
    }
}
开发者ID:NaturalWill,项目名称:Simple-Healthcare-Consulting-System-API,代码行数:39,代码来源:submit.php

示例9: __construct

 /**
  * @param array $data Data to preload on object creation
  */
 public function __construct($data = null)
 {
     $this->db = MysqliDb::getInstance();
     if (empty($this->dbTable)) {
         $this->dbTable = get_class($this);
     }
     if ($data) {
         $this->data = $data;
     }
 }
开发者ID:nightstomp,项目名称:PHP-MySQLi-Database-Class,代码行数:13,代码来源:dbObject.php

示例10: __construct

 /**
  * @param array $data Data to preload on object creation
  */
 public function __construct($data = null)
 {
     $this->db = MysqliDb::getInstance();
     if ($data) {
         $this->data = $data;
     }
 }
开发者ID:TwistItLabs,项目名称:website,代码行数:10,代码来源:dbObject.php


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