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


PHP DBConnector::connect方法代碼示例

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


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

示例1: getJSONFromDB

 public function getJSONFromDB()
 {
     $db = new DBConnector();
     $sql = "SELECT s.spieltag, s.datum, sp.datum, sp.stadion, sp.heim, sp.gast, sp.tore_heim, sp.tore_gast FROM spieltag s, spiele sp WHERE s.spieltag = sp.spieltag_id";
     $mysql = $db->connect();
     $result = $mysql->query($sql);
     $json = array();
     while ($row = $result->fetch_assoc()) {
         $json[] = $row;
     }
     return $json;
 }
開發者ID:nxnc,項目名稱:WPF_MW,代碼行數:12,代碼來源:json.php

示例2: connect

 /**
  * Instruct the database to generate a live connection
  *
  * @param array $parameters An map of parameters, which should include:
  *  - server: The server, eg, localhost
  *  - username: The username to log on with
  *  - password: The password to log on with
  *  - database: The database to connect to
  *  - charset: The character set to use. Defaults to utf8
  *  - timezone: (optional) The timezone offset. For example: +12:00, "Pacific/Auckland", or "SYSTEM"
  *  - driver: (optional) Driver name
  */
 public function connect($parameters)
 {
     // Ensure that driver is available (required by PDO)
     if (empty($parameters['driver'])) {
         $parameters['driver'] = $this->getDatabaseServer();
     }
     // Notify connector of parameters
     $this->connector->connect($parameters);
     // SS_Database subclass maintains responsibility for selecting database
     // once connected in order to correctly handle schema queries about
     // existence of database, error handling at the correct level, etc
     if (!empty($parameters['database'])) {
         $this->selectDatabase($parameters['database'], false, false);
     }
 }
開發者ID:miamollie,項目名稱:echoAerial,代碼行數:27,代碼來源:Database.php

示例3: Collection

<?php

/**
 * Created by PhpStorm.
 * User: Denis
 * Date: 30.11.2015
 * Time: 12:44
 */
$collection = new Collection();
$connection = new DBConnector();
$db = $connection->connect();
$sql = mysql_query("SELECT * FROM author", $db);
var_dump($sql);
$author_1 = new SimpleAuthor();
開發者ID:DenisGoldiner,項目名稱:library,代碼行數:14,代碼來源:test.php


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