本文整理匯總了PHP中DbConnect類的典型用法代碼示例。如果您正苦於以下問題:PHP DbConnect類的具體用法?PHP DbConnect怎麽用?PHP DbConnect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DbConnect類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct()
{
// opening db connection
$db = new DbConnect();
$this->conn = $db->connect();
//$this->echoAllConstituentNames();
}
示例2: __construct
function __construct()
{
require_once 'dbconn.php';
// CONNESSIONE
$db = new DbConnect();
$this->conn = $db->connect();
}
示例3: getAllBirthdays
function getAllBirthdays()
{
$conn = new DbConnect();
$query = $conn->getHandler()->query("SELECT * FROM dinosaur");
$result = $query->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
示例4: __construct
function __construct()
{
require_once dirname(__FILE__) . '/DbConnect.php';
// opening db connection
$db = new DbConnect();
$this->conn = $db->connect();
}
示例5: __construct
function __construct()
{
$this->columns = array();
require_once 'config/DbConnect.php';
// opening db connection
$db = new DbConnect();
$this->conn = $db->connect();
}
示例6: __construct
public function __construct()
{
for ($i = 1; $i <= $this->getInitialSize(); $i++) {
$dbConnect = new DbConnect();
$dbConnect->setCreated(time());
$this->addConnect($dbConnect);
}
}
示例7: __construct
function __construct()
{
require_once dirname(__FILE__) . '/db_connect.php';
require_once dirname(__FILE__) . '/mail/class.phpmailer.php';
require_once dirname(__FILE__) . '/mail/class.smtp.php';
// opening db connection
$db = new DbConnect();
$this->conn = $db->connect();
}
示例8: __construct
function __construct()
{
require_once dirname(__FILE__) . '/DbConnect.php';
//open new database
try {
$db = new DbConnect();
//instantiate the DbConnect class
$this->conn = $db->connect();
} catch (PDOException $ex) {
$this::dbConnectError($ex->getCode());
}
}
示例9: __construct
function __construct()
{
require_once dirname(__FILE__) . '/DbConnect.php';
//open new database connection
try {
$db = new DbConnect();
//instantiate the DbConnect class
$this->conn = $db->connect();
} catch (Exception $ex) {
$this::dbConnectError($ex->getCode());
exit;
//unconditionally stop processing
}
}
示例10: __construct
function __construct()
{
require_once dirname(__FILE__) . '/DbConnect.php';
// abriendo conexión
$db = new DbConnect();
$this->conn = $db->connect();
session_start();
if (isset($_SESSION['user'])) {
$user_logged_in = true;
}
if (isset($_SESSION['copisteria'])) {
$copisteria_logged_in = true;
}
}
示例11: getSubcategory
public function getSubcategory($id)
{
$connection = new DbConnect();
$pdo = $connection->connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = "select * from subcategories\n where id = :id";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':id', $id);
$stmt->setFetchMode(PDO::FETCH_CLASS, 'Subcategory');
$stmt->execute();
$subcategory = $stmt->fetch();
return $subcategory;
//return $this;
}
示例12: get
public static function get()
{
if (!isset(self::$instance)) {
self::$instance = new DbConnect();
}
return self::$instance;
}
示例13: getContacts
private function getContacts()
{
$this->table = 'contacts';
//Select query
$this->query_string = "SELECT * FROM %s WHERE user_id = '%s'";
//Package array for query arguments
$this->packageArguments();
//Connect to database
$this->db = DbConnect::get();
//Query db
$this->result = $this->db->query($this->query_string, $this->arguments);
//Reset Session
$this->contacts_array = array();
//Turn result into associative array
if (mysql_num_rows($this->result)) {
while ($this->contacts = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
$this->contact = array('contact_id' => $this->contacts['id'], 'first_name' => $this->contacts['first_name'], 'last_name' => $this->contacts['last_name'], 'phone_one' => $this->contacts['phone_one'], 'phone_two' => $this->contacts['phone_two'], 'phone_three' => $this->contacts['phone_three'], 'email' => $this->contacts['email'], 'company' => $this->contacts['company'], 'address_one' => $this->contacts['address_one'], 'address_two' => $this->contacts['address_two'], 'city' => $this->contacts['city'], 'state' => $this->contacts['state'], 'zip_code' => $this->contacts['zip_code'], 'notes' => $this->contacts['notes']);
array_push($this->contacts_array, $this->contact);
}
return $this->contacts_array;
} else {
$this->error_message = "You have No Contacts";
return $this->error_message;
}
}
示例14: delete
public static function delete($id)
{
$pdo = DbConnect::connect();
$sql = "DELETE from abteilung WHERE id=:id";
$stmt = $pdo->prepare($sql);
$stmt->execute([':id' => $id]);
}
示例15: __construct
public function __construct()
{
$db = DbConnect::getInstance();
$this->conn = $db->getConnection();
if (!$this->conn) {
throw new Exception("cannot connect to server");
}
return $this->conn;
}