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


PHP DBManager::connect方法代碼示例

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


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

示例1: say_error

 <?php 
/* Test unit para comprobar los metodos de la clase DBManager
 * Puede generar un monton de usuarios dummys que deberan de ser eliminados en su dia
 * Felipe Vieira
 */
require "DBManager.php";
$man = new DBManager();
function say_error($correct)
{
    if ($correct) {
        echo "creacion realizada correctamente<br/>";
    } else {
        echo "Ya existia un dato asi en la base de datos<br/>";
    }
}
if ($man->connect()) {
    say_error($man->insertarRol("rolDummy1", "rol de test unit"));
    say_error($man->insertarFun("funDummy1", "funcion de test unit"));
    say_error($man->insertarPag("pagDummy1", "pagina de test unit"));
    say_error($man->insertarUser("userDummy1", "12345", "usuario de test unit", "dummy@dummy"));
    say_error($man->insertarRol("rolDummy2", "rol de test unit"));
    say_error($man->insertarFun("funDummy2", "funcion de test unit"));
    say_error($man->insertarPag("pagDummy2", "pagina de test unit"));
    say_error($man->insertarUser("userDummy2", "12345", "usuario de test unit", "dummy@dummy"));
    $result = $man->listRolesByUser("userDummy1");
    $result = $man->listRolesByFun("userDummy1");
    $result = $man->listUsersByRol("rolDummy1");
    foreach ($result as $item) {
        echo $item;
    }
}
開發者ID:naraah,項目名稱:iu-esei-proyecto,代碼行數:31,代碼來源:testUnitDBManager.php

示例2: DBManager

        print 'No Notifier Selected.';
        break;
}
$objNotifier->notify();
print "</br>";
/*----------  Design Patterns: Strategy Pattern  ----------*/
//$MM = new MySQLManager();
//$MM->setHost("localhost");
//$MM->setDB("db");
//$MM->setUserName("user");
//$MM->setPassword("password");
//$MM->connect();
// ... do all this to other database drivers ...
$DM = new DBManager();
$DM->setDriver('mysql');
$DM->connect('host', 'database', 'user_mysql', 'admin');
/*----------  Design Patterns: Abstract Pattern  ----------*/
$manager = new MySQLManagerAbstract();
$manager->setUserName('wdarking');
$manager->connect();
/*----------  Design Patterns: Singleton Pattern  ----------*/
$a = new MySQLManager();
$b = new MySQLManager();
$c = new MySQLManager();
$d = new MySQLManager();
$e = new MySQLManager();
/*----------  Design Patterns: Iterator Pattern  ----------*/
/*$blogposts = getAllPosts();
$posts = new Posts($blogposts);
foreach ($posts as $post) {
	echo($post->getTitle());
開發者ID:wdarking,項目名稱:php_exercises,代碼行數:31,代碼來源:index.php

示例3: DBManager

$db->setHost("192.168.1.11");
$db->setUser("admin");
$db->setPassword("admin");
$db->setDBName("mambo");
$db->connect();
$SQLCmd = "select  id, menutype, name from mos_menu";
*/
/*
$db = new DBManager($DB_MANAGER->DB_ORACLE8);
$db->parseURL("db.oci8://reward:reward2005@flexim");
$db->connect();
$SQLCmd = "select * from watch";
*/
$db = new DBManager($DB_MANAGER->DB_POSTGRES);
$db->parseURL("db.postgres://inms_md:rahasia@127.0.0.1:5432/flextor");
$db->connect();
$SQLCmd = "SELECT * FROM ipm_sc.modules";
if (!$db->isConnect) {
    echo "not connected<br>";
    echo $db->getHost() . "<br>";
    echo $db->getPort() . "<br>";
    echo $db->getUser() . "<br>";
    echo $db->getPassword() . "<br>";
}
/* Querying Database */
//$resultsets = new ResultSet();
$resultsets = new ResultSet();
$resultsets = $db->query($SQLCmd);
echo "Result Count = " . $resultsets->size() . " column = " . $resultsets->columnSize() . "<br>";
$counter = 0;
while ($resultsets->next()) {
開發者ID:bryanbacus,項目名稱:skripsi-martin,代碼行數:31,代碼來源:dbTest.php


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