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