當前位置: 首頁>>代碼示例>>PHP>>正文


PHP dbConnect::connect方法代碼示例

本文整理匯總了PHP中dbConnect::connect方法的典型用法代碼示例。如果您正苦於以下問題:PHP dbConnect::connect方法的具體用法?PHP dbConnect::connect怎麽用?PHP dbConnect::connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dbConnect的用法示例。


在下文中一共展示了dbConnect::connect方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dbConnect

 function __construct()
 {
     require_once 'dbConnect.php';
     // opening db connection
     $db = new dbConnect();
     $this->conn = $db->connect();
 }
開發者ID:jackpower,項目名稱:objectivemoney-angular,代碼行數:7,代碼來源:dbHandler.php

示例2: dirname

 /**
  * 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

示例3: dirname

 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: dbConnect

<?php

/************************************************************
DEPENDENCIES
************************************************************/
require '../../settings.php';
/************************************************************
AJAX REQUEST
************************************************************/
$postdata = file_get_contents("php://input");
$dataobject = json_decode($postdata);
$post_id = $dataobject->id;
$post_status = $dataobject->status;
$post_title = $dataobject->title;
$post_date = $dataobject->date;
$post_content = $dataobject->input;
/************************************************************
DATABASE CONNECTION
************************************************************/
$connection = new dbConnect();
$pdo = $connection->connect();
/************************************************************
QUERY
************************************************************/
$querystring = "UPDATE posts SET post_status = :post_status, post_title = :post_title, post_date = :post_date, post_content = :post_content WHERE id = :post_id";
$preparedstatement = $pdo->prepare($querystring);
$preparedstatement->execute(["post_status" => $post_status, "post_title" => $post_title, "post_date" => $post_date, "post_content" => $post_content, "post_id" => $post_id]);
echo true;
開發者ID:GabrielDCelery,項目名稱:website-baluswimbus,代碼行數:28,代碼來源:edit_post.php

示例6: insertIntoTable

 /**
  * Creating new record
  */
 public function insertIntoTable($obj, $column_names, $table_name)
 {
     $db = new dbConnect();
     $this->conn = $db->connect();
     $c = (array) $obj;
     $keys = array_keys($c);
     $columns = '';
     $values = '';
     foreach ($column_names as $desired_key) {
         // Check the obj received. If blank insert blank into the array.
         if (!in_array($desired_key, $keys)) {
             ${$desired_key} = '';
         } else {
             ${$desired_key} = $c[$desired_key];
         }
         $columns = $columns . $desired_key . ',';
         $values = $values . "'" . ${$desired_key} . "',";
     }
     $query = "INSERT INTO " . $table_name . "(" . trim($columns, ',') . ") VALUES(" . trim($values, ',') . ")";
     $r = $this->conn->query($query) or die($this->conn->error . __LINE__);
     if ($r) {
         $new_row_id = $this->conn->insert_id;
         $db->disconnect();
         return $new_row_id;
     } else {
         $db->disconnect();
         return NULL;
     }
 }
開發者ID:albizures,項目名稱:anadie,代碼行數:32,代碼來源:dbHandler.php


注:本文中的dbConnect::connect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。