当前位置: 首页>>代码示例>>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;未经允许,请勿转载。