Database
Introduction
$sql = e107::getDb();Basic database methods
select()
$sql->select($table, $fields = '*', $arg = '', $noWhere = false, $debug = false, $log_type = '', $log_remark = '')Parameter
Type
Description
Mandatory?
Example #1: Simple select
Example #2: Using arguments
Example #3: Using arguments with noWhere option
Example #4: BIND support
fetch()
insert()
update()
retrieve()
Parameter
Type
Description
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()
gen()
Example: perform a JOIN with gen():
Advanced database methods
connect()
Parameter
Type
Description
count()
database()
Parameter
Type
Description
getLastErrorNumber()
getLastErrorText()
Last updated
Was this helpful?