See Announcements
$myDb = Factory::getContainer()->get('DatabaseDriver');
// Get a db connection.
$myDb = Factory::getContainer()->get('DatabaseDriver');
// Create a new query object.
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('fieldA', 'fieldB'));
->from('tablename')
->where('fieldC = ' . $myDb->quote('value'));
// Assign the query to the db
$myDb->setQuery($myQuery);
// Load the results as an array of objects.
$rows = $myDb->loadObjectList();
// Get a db connection.
$myDb = version_compare(\Joomla\CMS\Version::MAJOR_VERSION, "4", ">=") ? Factory::getContainer()->get('DatabaseDriver') : Factory::getDbo();
// Create a new query object.
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('fieldA', 'fieldB'))
->from('tablename')
->where('fieldC = ' . $myDb->quote('value'));
// Assign the query to the db
$myDb->setQuery($myQuery);
// Load the results as an array of objects.
$rows = $myDb->loadObjectList();
// Get a db connection.
$myDb = JFactory::getDbo();
// Create a new query object.
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('fieldA', 'fieldB'))
->from('tablename')
->where('fieldC = ' . $myDb->quote('value'));
// Assign the query to the db
$myDb->setQuery($myQuery);
// Load the results as an array of objects.
$rows = $myDb->loadObjectList();
$list = array();
foreach ($rows as $row)
{
$list[] = "<li>" . $row->fieldA . " " . $row->fieldB . "</li>";
}
return "<ol>" . implode($list) . "</ol>";
$myDb = version_compare(\Joomla\CMS\Version::MAJOR_VERSION, "4", ">=") ? Factory::getContainer()->get('DatabaseDriver') : Factory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('fieldA', 'fieldB'))
->from('tablename')
->where('fieldC = ' . $myDb->quote('value'));
$myDb->setQuery($myQuery);
$row = $myDb->LoadObject();
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('fieldA', 'fieldB'))
->from('tablename')
->where('fieldC = ' . $myDb->quote('value'));
$myDb->setQuery($myQuery);
$row = $myDb->LoadObject();
$row = $listModel->getRow($rowId);
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select('fieldA')
->from('tablename')
->where('fieldC = ' . $myDb->quote('value'));
$myDb->setQuery($myQuery);
$fieldA = $myDb->loadResult();
return $fieldA;
// Get a db connection.
$myDb = version_compare(\Joomla\CMS\Version::MAJOR_VERSION, "4", ">=") ? Factory::getContainer()->get('DatabaseDriver') : Factory::getDbo();
// Create a new query object.
$myQuery = $myDb->getQuery(true);
// Insert columns.
$columns = array('fieldA', 'FieldB');
// Insert values.
$values = array('1', '2');
// Prepare the insert query.
$myQuery
->insert($myDb->quoteName('tablename'))
->columns($myDb->quoteName($columns))
->values(implode(',', $myDb->quote($values)));
// Reset the query using our newly populated query object.
$myDb->setQuery($myQuery);
try {
// Execute the query
$result = $myDb->execute();
//use $myDb->query() in Joomla2.5
}
catch (Exception $e) {
// catch any database errors.
}
$newid = (int)$myDb->insertid(); //get new record id
$IDinput = '{rowid}';
// Get the db object
//$myDb = JFactory::getDbo();// for Joomla 3
$myDb = version_compare(\Joomla\CMS\Version::MAJOR_VERSION, "4", ">=") ? Factory::getContainer()->get('DatabaseDriver') : Factory::getDbo();// for Joomla 4+
// Build the query ? Tables names = CASE SENSITIVE
$myQuery = $myDb->getQuery(true);
$myQuery
-> update('contacts AS c')
-> join('INNER','contactsstatus AS s ON s.Status = \'New\'')
-> set('c.Status = s.id')
-> where('c.id = '. (int) $IDinput);
$myDb->setQuery($myQuery);
// Run the query
$found = (int) $myDb->execute();
//use $myDb->query() in Joomla2.5
$myDb = FabrikWorker::getDbo(false, 2);
// Fabrik 3.1
$listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
// Fabrik 3.0
$listModel = JModel::getInstance('List', 'FabrikFEModel');
$listModel->setId(1);
$data = $listModel->getData();
// Get params
$params = $listModel->getParams();
JModel::addIncludePath(JPATH_SITE . '/components/com_fabrik/models');
$row = $listModel->getRow($rowid);
$user = Joomla\CMS\Factory::getApplication()->getIdentity();
$user = JFactory::getUser();
$userid = $user->get('id');
$name = $user->get('name');
$username = $user->get('username');
$email = $user->get('email');
use Joomla\CMS\Factory;
$user = \Joomla\CMS\Factory::getApplication()->getSession()->get('user');
$customFields = FieldsHelper::getFields('com_users.user', $user, 0);
foreach ($customFields as $field) {
echo '$field=' . $field->name . '<br>';
echo '$value=' . $field->value . '<br>';
echo '<br>--<br>';
}
$user = Joomla\CMS\Factory::getApplication()->getIdentity();
$Groups = $user->getAuthorisedGroups();
$user = Joomla\CMS\Factory::getApplication()->getIdentity();
$myViewLevels = $user->getAuthorisedViewLevels();
//not tested for Joomla 4
$myApp = JFactory::getApplication();
$myparam= $myApp->input->get('urlparam');
$myApp = JFactory::getApplication();
$date= $myApp->input->getString('tablename___dateelement');
$date = strtotime($date);
$now = time();
$diff = $now - $date;
$years = floor($diff / 31556926);
return ($years >= 18 && $years <= 90);
$nowdate = strtotime("{table___element}");
$thendate = strtotime("today");
$datediff = ($thendate - $nowdate);
$diff = round($datediff / 86400);
return $diff;
$cond1 = ('{table___element}' == 'X');
$nowdate = strtotime("{table___element}");
$thendate = strtotime("today");
$datediff = ($thendate - $nowdate);
$diff = round($datediff / 86400);
$cond2 = ($diff == X);
return $cond1 <> $cond2;
$date1 = strtotime("{table___update_raw}");
$date2 = strtotime("{table___createdate_raw}");
$date2 = strtotime("+16 day", $date2);
return $date1 > $date2;
$query->setQuery('SELECT date_format(date, "%d %M %Y", "fr_FR") as frenchdate FROM table_name WHERE my_condition = X');
{thistable}.view_level IN (SELECT DISTINCT `#__viewlevels`.`id`
FROM #__user_usergroup_map
LEFT JOIN #__viewlevels ON REPLACE(REPLACE(rules,'[',','),']',',') LIKE CONCAT('%,',`group_id`,',%')
WHERE user_id ='{$my->id}')
/**
* Function to send an email
*
* @param string $from From email address
* @param string $fromName From name
* @param mixed $recipient Recipient email address(es)
* @param string $subject email subject
* @param string $body Message body
* @param boolean $mode false = plain text, true = HTML
* @param mixed $cc CC email address(es)
* @param mixed $bcc BCC email address(es)
* @param mixed $attachment Attachment file name(s)
* @param mixed $replyTo Reply to email address(es)
* @param mixed $replyToName Reply to name(s)
* @param array $headers Optional custom headers, assoc array keyed by header name
*
* @return boolean True on success
*
* @since 11.1
*/
public static function sendMail($from, $fromName, $recipient, $subject, $body, $mode = false,
$cc = null, $bcc = null, $attachment = null, $replyTo = null, $replyToName = null, $headers = array())