O'Reilly logo

Mastering Joomla! 1.5 Extension and Framework Development by Chuck Lanham, James Kennard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the database

Joomla! makes extensive use of the database and provides some powerful tools for accessing, retrieving, and updating the database. At initialization, Joomla! creates a connection to the database by instantiating a global JDatabase object. This database connection can be accessed within your extension by assigning an object reference to a local variable using the static JFactory class method getDBO(), as is shown in the following:

$db =& JFactory::getDBO();

Note

Note that we must use =& which assigns a reference to the existing database object to the variable; using = will create a copy of the existing database object.

Two subclasses, JDatabaseMySQL and JDatabaseMySQLi, extend the JDatabase class depending on the exact database ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required