From Joomla! Documentation

Revision as of 17:36, 29 October 2009 by Jlainezs (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Code snippet

Execute a query and get a lists of objects

$_db is setted on the constructor of the class (not shown here).

class MyTable extends JTable
    var $_db;
    function getSomeObjectsList(){
        $q = "<your query>";
        $rows = $this->_db->loadObjectList();
        return $rows;

$q has an SQL sentence. All needed is to set the query and return the rows. After assigning $rows should be convenient to check for errors.