Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

PHPLIB and Multiple Databases
Including PHPLIB
PHPLIB accesses SQL databases through a class named DB_Sql. You include the version for your database in your code. I use the MySQL version in this example.
To get DB_Sql in to your code, install the PHPLIB files in their own directory. Then, find your cgi-bin directory and create the phplib directory next to the cgi-bin directory. Next, copy all the PHPLIB .inc files in to the phplib directory. Finally, put the phplib directory in to the php.inc file in the line starting with include_path =.
The include_path is where PHP grabs files named in include() or require(). On my NT workstation, the include path is...
 include_path = ".;i:/project52/includes;i:/project52/phplib";
On the Linux production machine, it is...
 include_path = ".;/home/httpd/includes;/home/httpd/phplib";
 
At the top of each PHP page is...

<?php

require(common.php3);

?>
common.php3 is in the includes directory and contains all the data and functions common to every page. In common.php3, are...

<?php

require(db_mysql.inc);
require(
ct_sql.inc);
require(
session.inc);
require(
auth.inc);
require(
perm.inc);
require(
user.inc);
require(
page.inc);

?>
Read the PHPLIB documentation at http://phplib.netuse.de and the fine articles at http://www.phpbuilder.com to find out which includes you need. Db_mysql.inc contains the DB_Sql class definition. If you want to use PostGreSQL instead of MySQL, include db_pgsql.inc instead of db_mysql.inc. There are 10 .incs covering MS SQL, Oracle, Sybase and others.
*Note that for this example, require() and include() are exactly the same. Require() and include() do work differently and have different results when used in the middle of your code or in if() statements.
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
RE: PHP Server Kanta02/11/05 04:03
RE: Play movie at web site with PHPdinesh12/11/04 03:29
PHP Server lid10/16/02 12:09
2 or more Level of Queries Solns?onez10/10/02 10:58
sql server &PHPali alinia09/11/02 05:47
where can i get PHPLIB?Alex07/26/02 21:33
Help Mysql_fecth_row undefined Ronal Y07/18/02 02:26
RE: Play movie at web site with PHPSpacecat07/09/02 03:05
How to hook up the database to the site?David07/05/02 23:56
myconnect() function not workingSalim Pinjar06/20/02 08:46
Play movie at web site with PHPDanny05/06/02 08:58
Help me!ldvhai04/24/02 23:56
sql server Hatem Gamal03/25/02 10:14
help me pls....zabehry03/23/02 01:37
RE: PHP with Oracleyoke02/22/02 23:09
Checkbox to DBsteque02/04/02 09:06
TEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Sheep01/21/02 21:48
RE: PHP & InterbaseSurojit Niyogi11/06/01 12:19
PHP & InterbaseMaxi10/26/01 13:26
Where can I get PHPLIB?Zenons10/19/01 06:20
globals $db_connect, $db_databaseMichael Assink09/20/01 18:43
RE: PHP with OracleHassan08/27/01 06:11
RE: Hellllppppp!K Black08/11/01 18:03
help me !!!danilo07/03/01 11:43
PHPLIB with PHP4Ricardo Matos06/07/01 13:27
RE: PHP with OracleRach05/31/01 01:34
RE: PHP with OracleRach05/31/01 01:25
RE: All Bad IdeasGold05/17/01 18:55
Do I need *.dllceria03/27/01 19:52
RE: .inc files, bad ideadsh02/11/01 17:43
RE: PHP with Oracleraj02/05/01 15:03
hello newbie here.frederick02/04/01 19:23
How can I log on a persistant oracle connectRichard Schottdorf01/09/01 11:01
RE: PHP with OracleJoerg Behrens12/19/00 14:20
Utilisation de php4 avec paradoxZarambaud12/18/00 04:29
RE: Why not just use ADODB -- its simpler?Nikolai Steenstrup12/11/00 21:20
RE: Sybase connection problem?Joeri Cornelissens12/11/00 09:28
Hellllppppp!Carrie12/10/00 05:17
PHP Data Synchronizationgirish12/05/00 01:42
RE: conversion of outer join in oracle to postgreTom Anderson11/29/00 18:02
RE: All Bad Ideasaris11/28/00 03:05
RE: Why not just use OOP?Robert Campbell11/17/00 08:30
RE: .inc files, bad ideaJan Lehnardt11/13/00 16:27
RE: extends OOPs?Peter Moulding11/13/00 14:28
.inc files, bad ideaJosh Duncan11/13/00 13:33
PHP with OracleHareshkumar Khandal11/12/00 23:59
RE: OOPs?Ying Zhang11/12/00 03:27
conversion of outer join in oracle to postgreAtul Vaze11/11/00 06:14
OOPs?Peter Moulding11/10/00 18:46
RE: DisappointedRex Byrns11/10/00 09:50
RE: DisappointedTim Perdue, PHPBuilder.com11/09/00 12:08
RE: DisappointedTom Anderson11/09/00 11:32
DisappointedTim Perdue, PHPBuilder.com11/09/00 10:41
RE: All Bad IdeasJohn Lim11/09/00 09:22
RE: Why not just use ADODB -- its simpler?John Lim11/09/00 09:06
Great LIB, I'm it's power user! :-)Ahmad Anvari11/08/00 15:00
RE: Why not just use ADO-DB?Tom Anderson11/08/00 13:50
RE: extend classes, not rewrite codeJoe Link11/08/00 13:12
Why not just use ADO-DB?Lucien Ceder11/08/00 12:23
All Bad IdeasTom Anderson11/08/00 11:12
extend classes, not rewrite codeDonncha O Caoimh11/08/00 08:13
Sybase connection problem?Toni Tunkkari11/08/00 02:26
Why not just use OOP?Willo van der Merwe11/08/00 02:05
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.