Functions
db_insert($table, $fields)
Run an insert query on the active database.
- Calling parameters
- $table
- The database table on which to run the insert query.
- $fields
- An associative array of the values to insert. The keys are the fields, and the corresponding values are the values to insert.
- Return
- A database query result resource, or FALSE if the query was not executed correctly.
db_update($table, $fields, $where, $where_type='AND')
Run an update query on the active database.
- Calling parameters
- $table
- The database table on which to run the insert query.
- $fields
- An associative array of the values to insert. The keys are the fields, and the corresponding values are the values to insert.
- $where
- The where rules for this update query.
- $where_type
- Whether to AND or OR the where rules together.
- Return
- A database query result resource, or FALSE if the query was not executed correctly.
db_delete($table, $where, $where_type='AND')
- Calling parameters
- $table
- The database table on which to run the insert query.
- $where
- The where rules for this update query.
- $where_type
- Whether to AND or OR the where rules together.
- Return
- A database query result resource, or FALSE if the query was not executed correctly.
db_where_clause($where, $where_type='AND', $where_keyword=TRUE)
Build the WHERE portion of an SQL query, based on the specified values.
- Calling parameters
- $where
- Associative array of rules in the WHERE clause. If a key in the array is numeric, the value is taken as a literal rule. If it is non-numeric, then it is assumed to be a field name and the corresponding value is the value that it must hold.
- $where_type
- Whether to AND or OR the where rules together.
- Return
- An array containing the where clause with sprintf() markers, and an array of values to substitute for them.
As an example, this $where clause would be translated as follows:
$where = array('name'=>'foo', 'type'=>'page', 'created < 1147567877')
becomes:
WHERE (name='foo') AND ('type'='page') AND (created < 1147567877')
db_fetch_all_as_objects($query)
Returns an array with all objects from a query. This function does not do a rewrite_sql for you.
- Calling parameters
- $query
- A database query string.
- Return
- An array containing an object for each row returned by the query.
db_fetch_all_as_arrays($query)
Returns an array with all arrays from a query. This function does not do a rewrite_sql for you.
- Calling parameters
- $query
- A database query string.
- Return
- An array containing an array for each row returned by the query.
- Calling parameters
- Return
-->
Recent comments
19 weeks 9 hours ago
19 weeks 9 hours ago
29 weeks 12 hours ago
29 weeks 2 days ago
29 weeks 5 days ago
33 weeks 2 days ago
47 weeks 2 days ago
47 weeks 4 days ago
48 weeks 3 days ago
48 weeks 4 days ago