v5:userguide:learn_abstraction:establishing_connection
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
v5:userguide:learn_abstraction:establishing_connection [2016/03/15 01:14] – created mnewnham | v5:userguide:learn_abstraction:establishing_connection [2016/03/15 17:31] (current) – [Including The ADOdb libraries] review dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
<- v5: | <- v5: | ||
+ | ~~NOTOC~~ | ||
====== Establishing A Connection ====== | ====== Establishing A Connection ====== | ||
- | connection needs to be first established to the database. The parameters required to connect to the database are the same as when using a direct PHP connection. For detailed information about connections see [[v5: | + | Before interacting with data, a connection needs to be first established to the database. The parameters required to connect to the database are the same as when using a direct PHP connection. For detailed information about connections, see [[v5: |
+ | |||
+ | ===== Selecting A Driver ===== | ||
+ | In addition to ensuring the correct database connection driver is available in the PHP configuration, | ||
+ | ===== Including The ADOdb libraries ===== | ||
+ | ADOdb versions 5 and lower do not support class autoloading, | ||
<code php> | <code php> | ||
include ' | include ' | ||
+ | /* | ||
+ | * This is the driver you have selected to use | ||
+ | */ | ||
+ | $driver = ' | ||
- | $db = newAdoConnection(' | + | $db = newAdoConnection($driver); |
+ | |||
+ | /* | ||
+ | * These are the parameters required to connect to the database see connect() | ||
+ | */ | ||
+ | |||
$db-> | $db-> | ||
</ | </ | ||
+ | |||
The returned '' | The returned '' | ||
Line 16: | Line 32: | ||
| | ||
can be executed. | can be executed. | ||
+ | ===== Debugging Connection Failures ===== | ||
+ | ADOdb provides a debugging mode, set simply by setting the parameter | ||
+ | $db-> | ||
+ | |||
+ | The earliest that it can be set is after the creation of the '' | ||
+ |
v5/userguide/learn_abstraction/establishing_connection.1458000858.txt.gz · Last modified: 2017/04/21 11:40 (external edit)