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