DatabaseConnection
Description
Database connection
Usage example:
- <?php
- require_once(APP_FRAMEWORK_LIBRARIES_PATH.'Database.php');
- try
- {
- while($array = $result->fetchAssoc())
- {
- }
- $myvar = 'Some \'text with quotes\' and "double quotes"';
- }
- catch(Exception $e)
- {
- // Error handling...
- }
- ?>
Located in /libraries/Database.php (line 42)
Method Summary
static DatabaseConnection
getInstance
()
int
affectedRows
()
string
getDatabase
()
int
insertID
()
bool
isConnected
()
Methods
static getInstance (line 72)
Get an instance on the database connection object, and connects to the mysql server if needed
To configure your connection, override these constants in your config:
- APP_DATABASE_HOST
- APP_DATABASE_USER
- APP_DATABASE_PASSWORD
- APP_DATABASE_NAME
- APP_DATABASE_CHARSET
DatabaseConnection
getInstance
()
isConnected (line 176)
bool
isConnected
()
quote (line 135)
Escape and quote variables so you can insert them safely
void
quote
( $string)
- $string
setCharset (line 105)
Sets the charset for the database connection
void
setCharset
( $charset)
- $charset