JFactory: getDBO usage of Joomla database operations, joomlagetdbo_PHP tutorial

Source: Internet
Author: User
Tags php foreach
JFactory: getDBO usage of Joomla database operations, joomlagetdbo. JFactory: getDBO usage of Joomla database operations. This document describes the JFactory: getDBO usage of Joomla database operations. For your reference, the details are as follows: JFactory: getDBO usage of Joomla database operations, joomlagetdbo

This example describes how to operate a Joomla database using JFactory: getDBO. We will share this with you for your reference. The details are as follows:

JFactory is a static class used to obtain references of various system objects.

GetDBO is the method for obtaining database objects and obtains the database connection object code:

$ Db = & JFactory: getDBO ();

With the database object, you can perform database operations and execute the query code:

<? Php $ db = & JFactory: getDBO (); $ query = 'SELECT FirstName FROM # tablename'; $ db-> setQuery ($ query ); ($ db-> query (); // execute changes, add, and delete) $ Result = $ db-> loadObjectList (); // Get a dataset?>

Get the dataset and output it to the following:

<? Php foreach ($ Result as $ key = >$ value) {echo $ value-> FirstName. ',' ;}?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.