Objective

How to make a select query in Joomla PHP pages.

Example: Selecting specific fields from users with condition and sorting

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('name', 'username', 'email')));
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('username') . ' LIKE '. $db->quote('%web%'));
$query->order('name ASC');
$db->setQuery($query);
$results = $db->loadObjectList();


See also:

Source:

 

Keep Me Informed

Keep me informed of the latest extensions releases and offers. One email maximum per month.

Offer Me A Coffee!

If you like my work, offer me a coffee! Nick.