Database
Please note: This page is under construction and has not been finished yet.
Introduction
Use the following to retrieve the database class object
Basic database methods
select()
Selecting data from a database table
table
string
Name of the database table
Yes
fields
string
Comma separated list of fields or "*
" or a single field name (get one);
arg
string|array
....
noWhere
boolean
debug
boolean
log type
log_remark
Example #1: Simple select
Example #2: Using arguments
Example #3: Using arguments with noWhere option
Example #4: BIND support
fetch()
Selecting, looping through and displaying selected data with the fetch() method:
insert()
Inserting data into a database table:
update()
Updating information in a database:
retrieve()
Combined select() and fetch() method.
table
string
Name of the database table to retrieve data from.
If empty, enters fetch only mode
fields
string
Comma separated list of fields or "*
" or a single field name (get one);
If $fields
is of type boolean and $where
is not found, $fields
overrides $multi
where
string
WHERE/ORDER/LIMIT etc. clause.
multi
string
If set to true, fetch all (multi mode)
Default: false
indexField
boolean
Field name to be used for indexing when in multi mode
Default: null
debug
boolean
....
Default: false
Example #1: Get a single value
Example #2: Get multiple table-row values
Example #3: Fetch all, don't append WHERE to the query, index by user_id, noWhere auto detected (string starts with upper case ORDER)
Example #4: Same as above but retrieve() is only used to fetch, not useable for single return value
Example #5: Using whole query example, in this case default mode is 'one'
Example #6: Using whole query example, multi mode - $fields argument mapped to $multi
delete()
Delete a record from a database table.
gen()
Generic query function to use various SQL commands.
Example: perform a JOIN with gen():
Advanced database methods
connect()
mySQLserver
string
IP or hostname of the SQL server
mySQLuser
string
SQL username
mySQLpassword
string
SQL password
newLink
boolean
force a new link connection if set to true Default: false
count()
database()
database
string
Database name
prefix
string
multiple
boolean
Set to true to maintain connection to a secondary database
newLink
boolean
force a new link connection if set to true Default: false
getLastErrorNumber()
getLastErrorText()
Last updated