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


PHP Db::connect方法代码示例

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


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

示例1: Db

 function __construct()
 {
     include 'files/config.php';
     $msql = new Db();
     $msql->connect();
     $this->is_login();
 }
开发者ID:nerdgeeksu,项目名称:FssWebSite,代码行数:7,代码来源:ajaxLoginModule.class.php

示例2: dologinAction

 public function dologinAction()
 {
     Db::connect();
     $bean = R::dispense('user');
     // the redbean model
     $required = ['Name' => 'name', 'Email' => 'email', 'User_Name' => ['rmnl', 'az_lower'], 'Password' => 'password_hash'];
     \RedBeanFVM\RedBeanFVM::registerAutoloader();
     // for future use
     $fvm = \RedBeanFVM\RedBeanFVM::getInstance();
     $fvm->generate_model($bean, $required);
     //the magic
     R::store($bean);
     $val = new validation();
     $val->addSource($_POST)->addRule('email', 'email', true, 1, 255, true)->addRule('password', 'string', true, 10, 150, false);
     $val->run();
     if (count($val->errors)) {
         Debug::r($val->errors);
         foreach ($val->errors as $error) {
             Notification::setMessage($error, Notification::TYPE_ERROR);
         }
         $this->redirect(Request::createUrl('login', 'login'));
     } else {
         Notification::setMessage("Welcome back !", Notification::TYPE_SUCCESS);
         Debug::r($val->sanitized);
         session::set('user', ['sanil']);
         $this->redirect(Request::createUrl('index', 'index'));
     }
 }
开发者ID:santonil2004,项目名称:ovc,代码行数:28,代码来源:loginController.php

示例3: conectar

function conectar()
{
    $con = new Db("localhost", "root", "benjamin13");
    $con->connect();
    $con->select_db("conquistadores");
    return $con;
}
开发者ID:niko-afv,项目名称:KS-Project,代码行数:7,代码来源:funciones.php

示例4: save

 public function save()
 {
     $query = "INSERT INTO miembros values (null,'" . $this->getNombre() . "',null,'" . $this->getEmail() . "')";
     $conn = new Db("localhost", "root", "benjamin13");
     $conn->connect();
     $conn->insert($query, "conquistadores");
 }
开发者ID:niko-afv,项目名称:KS-Project,代码行数:7,代码来源:Miembro.php

示例5: login

 public function login()
 {
     $conn = Db::connect();
     $sql = 'SELECT user_id FROM users ' . ' WHERE email = ? AND password = ?';
     $email = $conn->real_escape_string($_POST['email']);
     $password = md5($_POST['password']);
     $statement = $conn->prepare($sql);
     $statement->bind_param('ss', $email, $password);
     $statement->execute();
     $statement->bind_result($userId);
     $statement->fetch();
     if ($userId == NULL) {
         return false;
     } else {
         session_start();
         $_SESSION['user_id'] = $userId;
         if (isset($_SESSION['cart']) && $_SESSION['cart'] != []) {
             require_once '../app/models/Cart.php';
             $cart = new Cart();
             foreach ($_SESSION['cart'] as $product_id => $value) {
                 $cart->addProductToCart($product_id, $_SESSION['cart'][$product_id]['cart_quantity']);
             }
         }
         return true;
     }
 }
开发者ID:matthewleighton,项目名称:online_shop,代码行数:26,代码来源:sessions_helper.php

示例6: getStandartTheme

 public static function getStandartTheme()
 {
     $db = Db::connect();
     $query = "SELECT themes.file FROM themes WHERE themes.id = 1";
     $result = $db->query($query)->fetch(PDO::FETCH_ASSOC);
     return $result['file'];
 }
开发者ID:yasch-kub,项目名称:auroracing.com,代码行数:7,代码来源:PageModel.php

示例7: deleteArticleById

 public function deleteArticleById($id)
 {
     $pdo = Db::connect();
     $sql = "DELETE FROM `article` WHERE `article_id` = {$id}";
     $query_result = $pdo->query($sql);
     return $query_result;
 }
开发者ID:nllx,项目名称:mvc,代码行数:7,代码来源:ArticleModel.php

示例8: __construct

 /**
  * Prywatny konstruktor klasy inicjujący połączenie z bazą danych
  * @global type $CONFIG mixed tablica przechowująca configuracje systemu
  */
 private function __construct()
 {
     global $CONFIG;
     self::$connect = new PDO('mysql:host=' . $CONFIG["host"] . ";dbname=" . $CONFIG["database"], $CONFIG["user"], $CONFIG["pass"]);
     self::$connect->query("SET NAMES utf8");
     self::$connect->query("SET CHARSET utf8");
     self::$connect->num_queries = 0;
 }
开发者ID:whitcik,项目名称:CeneoComments,代码行数:12,代码来源:Db.php

示例9: db

 /**
  * Return an instance of Db Class
  * If not connection to the database is made then firstly will try to connect to the database
  * If connection to the database fails then `false` value will be returned
  * 
  * @return  Mixed;
  */
 public function db()
 {
     if (!self::$db) {
         self::$db = new Db($this->config('db'));
         self::$db->connect();
     }
     return self::$db;
 }
开发者ID:spirlici,项目名称:spcms,代码行数:15,代码来源:mvc.class.php

示例10: incrementProductQuantity

 public static function incrementProductQuantity($productId, $quantity)
 {
     $sql = "UPDATE shopping_cart SET cart_quantity = cart_quantity + ? " . "WHERE fk_shopping_cart_user = ? AND fk_shopping_cart_product_version = ?";
     $conn = Db::connect();
     $statement = $conn->prepare($sql);
     $statement->bind_param('iii', $quantity, $_SESSION['user_id'], $productId);
     $statement->execute();
 }
开发者ID:matthewleighton,项目名称:online_shop,代码行数:8,代码来源:carts_helper.php

示例11: setup

 public function setup()
 {
     global $baseParams;
     $db = new Db($baseParams['__YKVAL_DB_DSN__'], 'root', 'lab', $baseParams['__YKVAL_DB_OPTIONS__']);
     $db->connect();
     # $db->truncateTable('queue');
     $db->disconnect();
 }
开发者ID:netcetera,项目名称:yubikey-val-server-php,代码行数:8,代码来源:syncLibTest.php

示例12: destroy

 public function destroy($wishListId)
 {
     $sql = 'DELETE FROM wish_list WHERE wish_list_id = ?';
     $conn = Db::connect();
     $stmt = $conn->prepare($sql);
     $stmt->bind_param('i', $wishListId);
     $stmt->execute();
     $stmt->close();
 }
开发者ID:matthewleighton,项目名称:online_shop,代码行数:9,代码来源:Wish_list.php

示例13: table

 static function table($with_db_name = true)
 {
     $conn = Db::getConnection('streams');
     $prefix = empty($conn['prefix']) ? '' : $conn['prefix'];
     $table_name = $prefix . 'notification';
     if (!$with_db_name) {
         return $table_name;
     }
     $db = Db::connect('streams');
     return $db->dbName() . '.' . $table_name;
 }
开发者ID:EGreg,项目名称:PHP-On-Pie,代码行数:11,代码来源:Notification.php

示例14: emptyCart

 public function emptyCart()
 {
     $sql = 'DELETE FROM shopping_cart WHERE fk_shopping_cart_user = ?';
     $database = Db::connect();
     $statement = $database->prepare($sql);
     $statement->bind_param('i', $_SESSION['user_id']);
     $statement->execute();
     if (isset($_SESSION['cart'])) {
         unset($_SESSION['cart']);
     }
 }
开发者ID:matthewleighton,项目名称:online_shop,代码行数:11,代码来源:Cart.php

示例15: runConfirmationQuery

 private function runConfirmationQuery($sql, $id)
 {
     $conn = Db::connect();
     $stmt = $conn->prepare($sql);
     $stmt->bind_param('ii', $id, $_SESSION['user_id']);
     $stmt->execute();
     $stmt->bind_result($id);
     $stmt->fetch();
     $conn->close();
     $_SESSION['test'] = $id;
     return $id;
 }
开发者ID:matthewleighton,项目名称:online_shop,代码行数:12,代码来源:Checkout_helper.php


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