The database class provides a wrapper of most common functions used for database access, and also others which simplify common queries. All queries performed with the database through the database abstraction layer can be analyzed for the execution time and further optimization.
Executes an SQL query with your database. Notice that the write_query method is now preferred.
Similar to the query method, except write_query executes the query on the slave database in case you happen to have a multi-database server setup. Write_query is now preferred over query. For more information, see the following post from Pirata Nervo: https://community.mybb.com/post-559029.html#pid559029
See Simple Select.
Returns an array of values for the first row (can be iterated through with a while statement)
Example:
$query=$db->query("SELECT * FROM Table [WHERE Field='Value']");
while($result=$db->fetch_array($query))
{
$data1=$result['FieldName1'];
$data2=$result['FieldName2'];
(etc.)
}
See Fetch_Field.
Returns the number of rows in the query
Returns the insert id (The id of the primary key) of the insert query just run
Runs an insert query on a table in a database. Receive two parameters:
- string - The table name to perform the query on.
- array - An array of fields and their values.
Build an insert query from the array and executes the query using $db->query
Runs an update query on a table in a database.
parameters: ('table name', 'update array', 'conditional')
Used to perform a delete query on a table in a database
Replaces addslashes, escapes data before being used in a query
Connects a new database.
Selects the database for the current MySQL Session
Helps to explain queries run from on database from the current session for debugging purposes.
Moves the internal pointer to the specified column
Closes the connection to the currently open database
Returns the error number (if any) of the specified query resource
Returns the error string (if any) of the specified query resource
Outputs an error message (if any) of the specified query resource
Returns the amount of affected rows from a "write" query
Returns the number of fields of the specified query resource
Returns the tables in the current open database
Returns true if the specified table exists
Returns true if the specified field exists
Runs a query thats performed when php is done parsing the file
Runs a complex query (join queries). (Note: Depreciated in MyBB 1.4)
Returns the version number of the database server being used
Runs an optimize query on a table
Runs an analyze query on a table
Return the "create table" command for a specific table.
Show the "show fields from" command for a specific table.
Returns whether or not the table contains a fulltext index.
Returns whether or not this database engine supports fulltext indexing.
Returns whether or not this database engine supports boolean fulltext matching.
Creates a fulltext index on the specified column in the specified table with optional index name.
Drop an index with the specified name from the specified table
Moderation | Standard Thread Moderation - Inline Thread Moderation - Inline Post Moderation - Warning System |
Mod CP | Home - Forums and Posts - Users |
Admin CP | Home - Configuration - Forums & Posts - Users & Groups - Templates & Style - Tools & Maintenance |
Templates & Themes | Images - Postbit - Templates - Themes |
Developer | Database Methods - Database Tables |
Miscellaneous | Cookies - UTF8 Setup - Default Settings |