[edit]
Definition
$xoopsDB is the XOOPS-wide database object, used to execute SQL queries in the database. It can also be retrieved through Database::getInstance();
[edit]
Usage
Important methods are:
query() - execute a query. Note that if the request method is GET, this method will only accept SELECT queries. Returns a database resultset queryF() - force an execution of a query without regard to request method. USE WITH CAUTION!!! getRowsNum($resultset) - returns number of rows in a resultset getAffectedRows() - returns number of rows changed by a query getInsertId() - returns the auto_increment id of the latest insertion query fetchRow($resultset) - returns an array of values from a row, indexed by number ($row0?, $row1? etc.) fetchArray($resultset) - returns an array of values from a row, indexed by fieldname ($row'field1'?, $row'field2'? etc.) quoteString($string) - ensures that a string is inserted in the database with proper quotes to avoid e.g. SQL injection
Back to Main Page



![[Main Page]](/modules/mediawiki/images/mediawiki.png)





