本文整理汇总了PHP中dbConnect类的典型用法代码示例。如果您正苦于以下问题:PHP dbConnect类的具体用法?PHP dbConnect怎么用?PHP dbConnect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了dbConnect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructor
**/
function __construct()
{
require_once dirname(__FILE__) . '/dbConnect.php';
//Open DB connection
$db = new dbConnect();
$this->conn = $db->connect();
}
开发者ID:hndr91,项目名称:untukpati-slim,代码行数:10,代码来源:dbHandler.php
示例2: __construct
function __construct()
{
require_once 'dbConnect.php';
// opening db connection
$db = new dbConnect();
$this->conn = $db->connect();
}
开发者ID:jackpower,项目名称:objectivemoney-angular,代码行数:7,代码来源:dbHandler.php
示例3: __construct
function __construct()
{
require_once dirname(__FILE__) . '/dbConnect.php';
$db = new dbConnect();
//Connect to database
$this->con = $db->connect();
//Select "friends" collection, already defined in config.php
$this->col = new MongoCollection($this->con, DB_COLLECTION);
}
开发者ID:hndr91,项目名称:slim-mongo,代码行数:9,代码来源:dbHandler.php
示例4: createTable
function createTable($name, $query)
{
$db = new dbConnect();
global $conn;
$result = mysqli_query($db->connect(), "create table if not exists {$name}({$query})");
if (!$result) {
die('failed to connect [' . $conn->connect_error . ']');
}
echo "Table '{$name}' created already.<br>";
}
开发者ID:Yuhuu,项目名称:Plan-with-fun,代码行数:10,代码来源:db_handler.php
示例5: doWork
function doWork()
{
try {
$dbh = dbConnect::getInstance()->dbh;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die;
}
if (empty($_POST["isDelete"])) {
$sql = "insert into material (material_type, description) values ";
$sql .= "(:material_type, :description) ";
$sql .= "on duplicate key update description = :description ";
$stmt = $dbh->prepare($sql);
$stmt->bindValue(":material_type", $_POST["txtMaterialType"]);
$stmt->bindValue(":description", $_POST["txtDescription"]);
} else {
$sql = "delete from material where material_type = :material_type ";
$stmt = $dbh->prepare($sql);
$stmt->bindValue(":material_type", $_POST["isDelete"]);
}
if ($stmt->execute()) {
header("Content-Type: application/json");
echo json_encode(array("result" => "success"));
} else {
header("Content-Type: application/json");
echo json_encode($stmt->errorInfo());
}
}
开发者ID:pkManee,项目名称:couple-master-project,代码行数:28,代码来源:ManageMaterialType.data.php
示例6: __construct
public function __construct($id)
{
$this->pdo = dbConnect::getInstance();
$this->id = $id;
$query = $this->pdo->query("SELECT * FROM shipy_user WHERE id = '" . $this->id . "' ");
$this->row = $query->fetch(PDO::FETCH_ASSOC);
}
开发者ID:axelschelfhout,项目名称:webapp,代码行数:7,代码来源:userInfo.class.php
示例7: login
function login($uname, $password, $checked)
{
$db = dbConnect::getInstance();
$mysqli = $db->getConnection();
$query = "SELECT * FROM users_tb WHERE mail= '" . $uname . "' AND pass = '" . md5($password) . "'";
$res = $mysqli->query($query);
if (mysqli_num_rows($res) > 0) {
$row = mysqli_fetch_array($res);
if ($row['type'] != "3") {
$_SESSION['cafeteriaSystem'] = $row['id'];
$_SESSION['type'] = $row['type'];
$_SESSION['name'] = $row['name'];
$_SESSION['pic'] = $row['pic_path'];
//echo $_SESSION['php'];
if ($checked == "1") {
setcookie("cafeteriaSystem", $row['id'], time() + 3600);
//echo $_COOKIE['php'];
}
if ($row['type'] == "1") {
header("location:orders.php");
} else {
header("location:index.php");
}
return TRUE;
}
} else {
return false;
}
}
开发者ID:Mayyad,项目名称:Tigers,代码行数:29,代码来源:uLogin.php
示例8: doWork
function doWork()
{
try {
$dbh = dbConnect::getInstance()->dbh;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die;
}
$sql = "update member set member_name = :member_name, address = :address, password = :password ";
$sql .= ",province_id = :province_id, province_name = :province_name ";
$sql .= ",amphur_id = :amphur_id, amphur_name = :amphur_name, ";
$sql .= ",district_id = :district_id, district_name = :district_name ";
$sql .= ",postcode = :postcode ";
$sql .= "where email = :email";
$stmt = $dbh->prepare($sql);
$stmt->bindValue(":member_name", $_POST["txtName"]);
$stmt->bindValue(":address", $_POST["txtAddress"]);
$stmt->bindValue(":password", $_POST["txtPassword"]);
$stmt->bindValue(":province_id", doExplode($_POST["cboProvince"])[0]);
$stmt->bindValue(":province_name", doExplode($_POST["cboProvince"])[1]);
$stmt->bindValue(":amphur_id", doExplode($_POST["cboAmphur"])[0]);
$stmt->bindValue(":amphur_name", doExplode($_POST["cboAmphur"])[1]);
$stmt->bindValue(":district_id", doExplode($_POST["cboDistrict"])[0]);
$stmt->bindValue(":district_name", doExplode($_POST["cboDistrict"])[1]);
$stmt->bindValue(":postcode", $_POST["txtPostCode"]);
$stmt->bindValue(":email", $_POST["email"]);
if ($stmt->execute()) {
header("Content-Type: application/json");
echo json_encode(array("result" => "success"));
} else {
header("Content-Type: application/json");
echo json_encode($stmt->errorInfo());
}
}
开发者ID:pkManee,项目名称:couple-master-project,代码行数:34,代码来源:_EditProfile.data.php
示例9: deleteShirtSize
function deleteShirtSize()
{
try {
$dbh = dbConnect::getInstance()->dbh;
} catch (PDOException $e) {
echo "Error!: " . $e->getMessage() . "<br/>";
die;
}
$sql = "delete from shirt_size where size_code = :size_code and gender = :gender ";
$stmt = $dbh->prepare($sql);
$stmt->bindValue(":size_code", $_POST["size_code"]);
$stmt->bindValue(":gender", $_POST["gender"]);
header("Content-Type: application/json");
if ($stmt->execute()) {
echo json_encode(array("result" => "success"));
} else {
//echo json_encode($stmt->errorInfo());
$errorCode = $stmt->errorCode();
if ($errorCode == '23000') {
echo json_encode(array('result' => 'ไม่สามารถลบได้ เนื่องจากได้มีการใช้ข้อมูลนี้ไปแล้ว !!!'));
} else {
echo json_encode($stmt->errorInfo());
}
}
}
开发者ID:pkManee,项目名称:couple-master-project,代码行数:25,代码来源:ManageShirtSize.data.php
示例10: mcacc_get_acc_list
function mcacc_get_acc_list()
{
$mc_db = dbConnect::getInstance();
if (!is_user_logged_in()) {
log("Neprisijunges vartotojas bando pasitikrinti savo acc ip: " . $_SERVER['REMOTE_ADDR']);
return;
}
}
开发者ID:VytautasBoznis,项目名称:Mc-Acc-Controll-Wordpress,代码行数:8,代码来源:mcacclist.php
示例11: newWord
public static function newWord()
{
$newWordID = self::getRandomID();
$sql = "SELECT * FROM word WHERE ID={$newWordID}";
$result = dbConnect::runSQL($sql);
$word = $result->fetch_assoc();
$wordLetters = str_split($word['word']);
$word['wordLetters'] = $wordLetters;
return $word;
}
开发者ID:k-lusine,项目名称:guessgame,代码行数:10,代码来源:model.php
示例12: execute
public function execute($sql)
{
$exe = mysql_query($sql, $this->_connAccess->getConnection());
if (!$exe) {
exit('Error : ' . mysql_error() . ':' . $sql);
} else {
return $exe;
dbConnect::closeConnection();
}
}
开发者ID:naufaldxdfam,项目名称:pdo-collection,代码行数:10,代码来源:db.php
示例13: getActiveCSS
public static function getActiveCSS()
{
$db = dbConnect::getReadOnly();
$query = "SELECT * FROM CSSTemplates WHERE ActiveState=1;";
$results = mysqli_query($db, $query);
$row = mysqli_fetch_assoc($results);
$activeCSSTemplate = new self($row);
dbConnect::closeConnection($db);
return $activeCSSTemplate;
}
开发者ID:ColinHill,项目名称:PHP-content-management-system,代码行数:10,代码来源:cssTemplate.php
示例14: getContentArea
public static function getContentArea()
{
$db = dbConnect::getReadOnly();
$query = "SELECT * FROM ContentAreas;";
$results = mysqli_query($db, $query);
while ($row = mysqli_fetch_assoc($results)) {
$contentAreas[] = new self($row);
}
//end while
dbConnect::closeConnection($db);
return $contentAreas;
}
开发者ID:ColinHill,项目名称:PHP-content-management-system,代码行数:12,代码来源:contentArea.php
示例15: getArticle
public static function getArticle($_area, $_page)
{
$db = dbConnect::getReadOnly();
$query = "SELECT * FROM Articles WHERE (Page='{$_page}' OR AllPages=1) AND ContentArea = '{$_area}';";
$result = mysqli_query($db, $query);
while ($row = mysqli_fetch_assoc($result)) {
$articleArray[] = new self($row);
}
//end while
dbConnect::closeConnection($db);
return $articleArray;
}
开发者ID:ColinHill,项目名称:PHP-content-management-system,代码行数:12,代码来源:article.php
示例16: getAllPages
public static function getAllPages($_alias)
{
$db = dbConnect::getReadOnly();
$query = "SELECT * FROM SitePages;";
$result = mysqli_query($db, $query);
while ($row = mysqli_fetch_assoc($result)) {
$pages[] = new self($row);
}
//end while
dbConnect::closeConnection($db);
return $pages;
}
开发者ID:ColinHill,项目名称:PHP-content-management-system,代码行数:12,代码来源:page.php
示例17: _getQuery
protected function _getQuery()
{
if (!$this->_query) {
$this->_conn = dbConnect::getConnection();
$this->_query = mysql_query($this->_sql, $this->_conn);
if (!$this->_query) {
print 'Error : ' . mysql_error() . ' ' . $this->_sql;
}
}
return $this->_query;
dbConnect::closeConnection();
}
开发者ID:JhovanovicBg99,项目名称:pdo-collection,代码行数:12,代码来源:Iterator.php
示例18: regist
function regist($fname, $lname, $address, $country, $gender, $uname, $password, $myskils, $department, $pic_name)
{
$db = dbConnect::getInstance();
$mysqli = $db->getConnection();
$query = " insert into users_tb set\n\t\t\t\t\t\tfname='" . $fname . "' ,\n\t\t\t\t\t\tlname='" . $lname . "' ,\t\n\t\t\t\t\t\taddress='" . $address . "' ,\n\t\t\t\t\t\ttype = '2' ,\n\t\t\t\t\t\tcountry = '" . $country . "' ,\n\t\t\t\t\t\tgender='" . $gender . "' ,\n\t\t\t\t\t\tmail='" . $uname . "' ,\n\t\t\t\t\t\tpassword='" . md5($password) . "' ,\n\t\t\t\t\t\tskils='" . $myskils . "' ,\n\t\t\t\t\t\tdept = '" . $department . "' ,\n\t\t\t\t\t\tprof_pic='" . $pic_name . "'\n\t\t\t";
$res = $mysqli->query($query) or die(mysqli_error($mysqli));
if ($res) {
return TRUE;
} else {
return false;
}
}
开发者ID:Mayyad,项目名称:Tigers,代码行数:12,代码来源:uRegister.php
示例19: insertOrder
function insertOrder()
{
try {
$dbh = dbConnect::getInstance()->dbh;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die;
}
$sql = 'insert into shirt_order ';
$sql .= '(email, line_screen_price_1, line_screen_price_2, shirt_id_1, ';
$sql .= 'shirt_id_2, qty_1, qty_2, order_status, order_date, amt, ';
$sql .= 'screen_width_1, screen_height_1, screen_width_2, screen_height_2, color_area_1, color_area_2) ';
$sql .= 'values';
$sql .= '(:email, :line_screen_price_1, :line_screen_price_2, :shirt_id_1, ';
$sql .= ':shirt_id_2, :qty_1, :qty_2, :order_status, curdate(), :amt, ';
$sql .= ':screen_width_1, :screen_height_1, :screen_width_2, :screen_height_2, :color_area_1, :color_area_2); ';
$sql .= 'update member set address = :address where email = :email; ';
$stmt = $dbh->prepare($sql);
$stmt->bindValue(':email', $_POST['email']);
$stmt->bindValue(':line_screen_price_1', $_POST['line_screen_price_1']);
$stmt->bindValue(':line_screen_price_2', $_POST['line_screen_price_2']);
$stmt->bindValue(':shirt_id_1', $_POST['shirt_id_1']);
$stmt->bindValue(':shirt_id_2', $_POST['shirt_id_2']);
$stmt->bindValue(':qty_1', $_POST['qty_1']);
$stmt->bindValue(':qty_2', $_POST['qty_2']);
$stmt->bindValue(':order_status', 'order');
$stmt->bindValue(':amt', $_POST['amt']);
$stmt->bindValue(':address', $_POST['address']);
$stmt->bindValue(':screen_width_1', $_POST['screen_width_1']);
$stmt->bindValue(':screen_height_1', $_POST['screen_height_1']);
$stmt->bindValue(':screen_width_2', $_POST['screen_width_2']);
$stmt->bindValue(':screen_height_2', $_POST['screen_height_2']);
$stmt->bindValue(':color_area_1', $_POST['color_area_1']);
$stmt->bindValue(':color_area_2', $_POST['color_area_2']);
if ($stmt->execute()) {
$orderId = $dbh->lastInsertId();
$target_dir = 'uploads/';
$dirToMake = '../' . $target_dir . $orderId;
mkdir($dirToMake);
$screen1 = $_POST['line_screen_1'];
saveFileToDir($dirToMake, $screen1, '01.png');
$screen2 = $_POST['line_screen_2'];
saveFileToDir($dirToMake, $screen2, '02.png');
$product = $_POST['product_image'];
saveFileToDir($dirToMake, $product, '03.png');
header("Content-Type: application/json");
echo json_encode(array('order_id' => $orderId));
} else {
header("Content-Type: application/json");
echo json_encode($stmt->errorInfo());
}
}
开发者ID:pkManee,项目名称:couple-master-project,代码行数:52,代码来源:ViewCart.data.php
示例20: login
public static function login($user, $pass)
{
$pass = md5($pass);
$pdo = dbConnect::getInstance();
if (empty($user) or empty($pass)) {
die('Niet alle velden zjin gevuld! Probeer nogmaals!');
}
$check = $pdo->prepare("SELECT * FROM shipy_user WHERE username = :user AND password = :pass ");
$check->execute(array(':user' => $user, ':pass' => $pass));
if ($check->rowCount() == 1) {
while ($row = $check->fetch(PDO::FETCH_ASSOC)) {
$_SESSION['log'] = $row['id'];
header('Location: /user/dashboard/');
}
} else {
die('Het opgegeven wachtwoord is verkeerd, of de gebruiker komt niet voor in de database. Probeer nogmaals!');
}
}
开发者ID:axelschelfhout,项目名称:webapp,代码行数:18,代码来源:userModel.class.php
注:本文中的dbConnect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论