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


PHP ConnectionFactory::connect方法代碼示例

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


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

示例1: foreach

<div>
     <h1> Physical Diagram </h1>
     <img class="dsgimage" src="images/physicaldg.jpg"/>
</div>

<div>
     <h1> Sql Designer view </h1>
     <img class="dsgimage" src="images/sqlrelation.jpg"/>
</div>



<?php 
// Include my book Class.
include "classes/books.class.php";
books::connect_it(ConnectionFactory::connect());
// using the function to display all stored date from table books
$books = books::allbooks("book");
if ($books !== false) {
    echo "<h1> Books Table </h1>";
    print "<table>\n               <tr>\n                    <th> isbn </th>\n                    <th> title </th>\n                    <th> description </th>\n                    <th> price </th>\n                    <th> publisher </th>\n                    <th> edition </th>\n                    <th> pages </th>\n\n               </tr>";
    foreach ($books as $row) {
        echo '<tr><td>' . $row->isbn . '</td><td>' . $row->title . '</td><td>' . $row->description . '</td>
      <td>' . $row->price . '</td><td>' . $row->publisher . '</td><td>' . $row->edition . '</td><td>' . $row->pages . '</td></tr>';
    }
    echo "</table>";
}
// calling function from class to display all stored date from table categories
$cat = books::allbooks("category");
if ($cat !== false) {
    echo "<h1> Categories Table </h1>";
開發者ID:waeltech,項目名稱:book-search,代碼行數:31,代碼來源:design.php

示例2: define

<?php

// Connection Details
// CHANGE TO YOUR DATABASE DETAILS
define("DB_DATA_SOURCE", "mysql:host=localhost;dbname=ifitness_db");
define("DB_USERNAME", "root");
define("DB_PASSWORD", "");
/*
define( "DB_DATA_SOURCE", "mysql:host=localhost;dbname=u1153568" );
define( "DB_USERNAME", "u1153568" );
define( "DB_PASSWORD", "18aug93" );
*/
// Class Configure
function __autoload($class)
{
    $folder = '/showcase';
    //$folder = '/stud/u1153568/final/showcase';
    require_once $_SERVER['DOCUMENT_ROOT'] . $folder . "/app/models/{$class}.php";
}
include_once "functions.php";
$conn = ConnectionFactory::connect();
$imgFld = 'assets/img/';
開發者ID:jacobd1808,項目名稱:Showcase,代碼行數:22,代碼來源:conn.php


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