本文整理汇总了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;
}