dbQuery
The dbQuery function is the main function used to send MySQL queries to the database.
The optional second parameter _ret defines the type of array to return - if set to "NUMERIC", it will return a numerical based array (default), else the KEY (column_name) whose value you want to use as the associative array KEYS can be given. If you simply want the database RESOURCE to be returned, leave empty. If the database query only returns ONE row, and _ret is SINGLE, then a single dimension array is returned, else if more than ONE row is returned, the _ret type kicks in and will produce a multi-dimensional array. You may also use "COUNT" for insert and update queries if you merely want the count of the number of rows affected by the query. Note that if no database connection has been established before calling this feature, a connection will be created.
mixed
dbQuery
(string $query, [string $_ret = false], [resource $con = null], [bool $unbuffered = false], [bool $only_val = false], [bool $memcache = false])
-
string
$query: The MySQL query to send to the database
-
string
$_ret: (optional) What type of results you want returned from the query. Can be:
- (empty) - if empty, the Database connection resource is returned for raw processing
- NUMERIC - returns a multi-dimensional array, numerically indexed beginning at 0
- SINGLE - a single-dimension array is returned
- COUNT - the number of rows affected by an INSERT, DELETE or UPDATE query
- INSERT_ID - the id from the auto_increment column of the table from the last INSERT query
- NUM_ROWS - the number of rows returned from a SELECT query
- $column - if name of valid column given, will be used as key in associative array. NOTE: the $column used must be a column that is returned as part of the SELECT statement.
-
resource
$con: Optional database connection - not needed if querying Jamroom database (set to null)
-
bool
$unbuffered: Whether to use mysql_unbuffered_query() (true) or mysql_query() (false) - EXPERIMENTAL
-
bool
$only_val: If set to a valid database table COLUMN name, then ONLY that column will be returned (instead of an array of values)
-
bool
$memcache: Whether to check the configured MemCached server for cached Query results - EXPERIMENTAL
|