本文整理汇总了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>";
示例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/';