本文整理汇总了PHP中DBConnector::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnector::getInstance方法的具体用法?PHP DBConnector::getInstance怎么用?PHP DBConnector::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnector
的用法示例。
在下文中一共展示了DBConnector::getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->db = DBConnector::getInstance();
}
示例2: session_start
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
require 'scripts/init.php';
loadScripts();
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$city = $_POST['city'];
$email = $_POST['email'];
$password = $_POST['password'];
$phonenumber = $_POST['phonenumber'];
$province = $_POST['province'];
$zipcode = $_POST['zipcode'];
$userid = $_SESSION['userid'];
$db = DBConnector::getInstance();
$password = MD5($password);
$sql = "UPDATE USERS\n SET ADDRESS = '{$address}', City= '{$city}', email = '{$email}',\n password = '{$password}', phonenumber = '{$phonenumber}', \n province = '{$province}', zipcode = '{$zipcode}'\n WHERE userid='{$userid}'";
$rows = $db->affectRows($sql);
$data = array();
if ($rows > 0) {
$data["msg"] = "Data updated!";
} else {
$data["msg"] = "Data could not be updated! Try again.";
}
echo json_encode($data, JSON_FORCE_OBJECT);
示例3: getInstance
/**
* Returns a global instance of DBQuery.
*
* @param string $sIncDir Base include path of current system. This param is used by GlobalSystemUpdate.
*
* @return DBQuery
*/
public static function getInstance()
{
if (!self::$oDBQuery instanceof DBQuery) {
self::$oDBQuery = new DBQuery(DBConnector::getInstance());
}
return self::$oDBQuery;
}
示例4: __construct
public function __construct()
{
$this->db = DBConnector::getInstance();
$_SESSION['cartId'] = $this->getCartId();
$this->cartId = $_SESSION['cartId'];
}
示例5: getLastId
public static function getLastId()
{
return DBConnector::getInstance()->lastInsertRowID();
}