- "Ask the Expert" or Advice Column
- "Must Have" Modules
- A Challenge
- Books Overview
- Changing Garland - A Practical Example
- Comparison of Links and Web Links modules
- Create Simple Tables
- Creating a "Biographies" page
- Developing a Module on a Windows System
- Generic Table Display
- How to page a custom DB query
- List Users From a Single Role in a Block
- My Modules
- Announcements: Special Notices for Your Site
- Attendance Matrix
- Content Type Template
- FAQ_Ask
- Get Content Type
- Glossary
- Gotcha - Contact Spam Catcher
- Helpers
- Indexpage: summary of node type information
- Longer Node Titles
- Node Type Filter
- Quotes
- RealName: Using Profile fields to set a user's displayed name
- Register_Country
- Site Documentation Module
- Site Notes: Hidden Design or How To notes in Your Database
- Spam Tokens
- Spam Tune
- Taxonomy Browser
- Taxonomy Delegate
- Taxonomy Image: Associate Images with Taxonomy Terms
- Taxonomy List: Displaying Lists of Terms
- SBS Web Site Notes
- Searching for a New Hosting Company
- Taxonomy Tidbits
- Theming a Specific Content Type
Helpers Database Functions
Submitted on Thu, 01/24/2008 - 02:46.
Functions
db_insert($table, $fields)
Run an insert query on the active databaseA collection of data related to an application..
- Calling parameters
- $table
- The databaseA collection of data related to an application. 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 databaseA collection of data related to an application. 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 databaseA collection of data related to an application..
- Calling parameters
- $table
- The databaseA collection of data related to an application. 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 databaseA collection of data related to an application. query result resource, or FALSE if the query was not executed correctly.
db_delete($table, $where, $where_type='AND')
- Calling parameters
- $table
- The databaseA collection of data related to an application. 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 databaseA collection of data related to an application. 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 SQLStructured Query Language - a language for accessing a database. 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_sqlStructured Query Language - a language for accessing a database. for you.
- Calling parameters
- $query
- A databaseA collection of data related to an application. 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_sqlStructured Query Language - a language for accessing a database. for you.
- Calling parameters
- $query
- A databaseA collection of data related to an application. query string.
- Return
- An array containing an array for each row returned by the query.
- Calling parameters
- Return
-->



Recent comments
2 weeks 17 hours ago
2 weeks 17 hours ago
2 weeks 17 hours ago
2 weeks 17 hours ago
2 weeks 17 hours ago
3 weeks 4 days ago
4 weeks 5 days ago
6 weeks 4 days ago
7 weeks 3 days ago
10 weeks 16 hours ago