The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

Next Previous Contents

21. Appendix I phpDB.inc Example

Submitted by: Joe Thong darkjoe@softhome.net Site URL: http://phpdb.linuxbox.com

Description: A PHP database wrapper for various database servers with a powerful Recordset for result data manipulation. Database results are flushed automatically by phpDB.

To get this file, in the web-browser, save this file as 'Text' type as phpDB.inc


<?php
/*
Name: phpDB General module
Version: 1.02bR6
Description: A PHP database wrapper for various 
        database servers.  Database results are flushed 
        automatically by phpDB.  Supported database 
        servers are MySQL, MSQL, PostgreSQL, Microsoft 
        SQL Server and Sybase. 
*/

        if (!defined("_PHPDB_GENERAL_LAYER")) {
          define("_PHPDB_GENERAL_LAYER", 1 );
        }
        else
                return;
        
        // Fill in the database server that you're
        // going to use.  Consult the phpDB Reference
        // Manual for more information
        $databaseType = '';
        // The phpDB module root path.  No trailing slash
        $phpDBRootPath = '.';   
        
        function useDB($dbType = "") 
        {
                GLOBAL $phpDBRootPath;
                switch (strtolower($dbType)) 
                {
                        case "mysql":
                        case "msql":
                        case "postgresql":
                        case "mssql":
                        case "sybase":
                        case "informix":
                                include("$phpDBRootPath". "/phpDB-" . "$dbType.lib");
                                break;
                        case "":
                                die("Please edit phpDB.inc in order to use phpDB");
                                return false;
                        default:
                                die("Invalid database selection");
                                return false;           
                }                                       
                return true;            
        }
        
        useDB($databaseType);
?>


Next Previous Contents


Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру