Actions

API15

JDatabaseMySQLi/query

From Joomla! Documentation

< API15:JDatabaseMySQLi
Revision as of 09:01, 12 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Execute the query

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

query()


Returns

mixed A database resource if successful, FALSE if not.

Defined in

libraries/joomla/database/database/mysqli.php

Importing

jimport( 'joomla.database.database.mysqli' );

Source Body

function query()
{
        if (!is_object($this->_resource)) {
                return false;
        }
 
        // Take a local copy so that we don't modify the original query and cause issues later
        $sql = $this->_sql;
        if ($this->_limit > 0 || $this->_offset > 0) {
                $sql .= ' LIMIT '.$this->_offset.', '.$this->_limit;
        }
        if ($this->_debug) {
                $this->_ticker++;
                $this->_log[] = $sql;
        }
        $this->_errorNum = 0;
        $this->_errorMsg = '';
        $this->_cursor = mysqli_query( $this->_resource, $sql );
 
        if (!$this->_cursor)
        {
                $this->_errorNum = mysqli_errno( $this->_resource );
                $this->_errorMsg = mysqli_error( $this->_resource )." SQL=$sql";
 
                if ($this->_debug) {
                        JError::raiseError(500, 'JDatabaseMySQL::query: '.$this->_errorNum.' - '.$this->_errorMsg );
                }
                return false;
        }
        return $this->_cursor;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />