Hello,
I am trying to get the following MySQL query to work in Chronoforms:
I have tried different variations of the following code but can't get it to populate:
I am pulling data from the user_usergroup_map table and the user_profiles table. Any help is greatly appreciated.
Thanks,
Alex
I am trying to get the following MySQL query to work in Chronoforms:
SELECT a.email, c.*
FROM knzqw_users a
INNER JOIN knzqw_user_usergroup_map b ON a.id = b.user_id
INNER JOIN knzqw_user_profiles c ON a.id = c.user_id
WHERE b.group_id = 11 AND profile_key = 'profile.phone'
I have tried different variations of the following code but can't get it to populate:
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('a.email', c*)))
->from($db->quoteName('#__users', 'a'))
->join('INNER', $db->quoteName('#__user_usergroup_map', 'b') . ' ON (' . $db->quoteName('a.id') . ' = ' . $db->quoteName('b.user_id') . ')')
->join('INNER', $db->quoteName('#__user_profiles', 'c') . ' ON (' . $db->quoteName('a.id') . ' = ' . $db->quoteName('c.user_id') . ')')
->where($db->quoteName('b.group_id'). ' = ' .db->$quote('11')) AND
->where($db->quoteName('c.profile_key'). ' = ' .$db->quote('profile.phone'));
$db->setQuery($query);
$emails= $db->loadColumn();
$form->data['list'] = implode(",", $emails);
print_r($list)
I am pulling data from the user_usergroup_map table and the user_profiles table. Any help is greatly appreciated.
Thanks,
Alex